LCOV - code coverage report
Current view: top level - sw/inc - unocrsrhelper.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 6 100.0 %
Date: 2014-04-11 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SW_INC_UNOCRSRHELPER_HXX
      20             : #define INCLUDED_SW_INC_UNOCRSRHELPER_HXX
      21             : 
      22             : #include <map>
      23             : 
      24             : #include <com/sun/star/beans/XPropertyState.hpp>
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : 
      27             : #include <swtypes.hxx>
      28             : #include <flyenum.hxx>
      29             : #include <pam.hxx>
      30             : 
      31             : class SfxItemSet;
      32             : class SfxItemPropertySet;
      33             : struct SfxItemPropertySimpleEntry;
      34             : class SdrObject;
      35             : class SwTxtNode;
      36             : class SwCursor;
      37             : class SwUnoCrsr;
      38             : class SwUnoTableCrsr;
      39             : class SwFmtColl;
      40             : struct SwSortOptions;
      41             : class SwDoc;
      42             : 
      43             : namespace sw { namespace mark { class IMark; } }
      44             : 
      45             : namespace com{ namespace sun{ namespace star{
      46             :     namespace uno{
      47             :         class Any;
      48             :     }
      49             :     namespace beans{
      50             :         struct PropertyValue;
      51             :     }
      52             :     namespace text {
      53             :         class XTextContent;
      54             :         class XFlatParagraphIterator;
      55             :     }
      56             : }}}
      57             : 
      58             : enum SwGetPropertyStatesCaller
      59             : {
      60             :     SW_PROPERTY_STATE_CALLER_DEFAULT,
      61             :     SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION,
      62             :     SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY,
      63             :     SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
      64             : };
      65             : 
      66             : namespace SwUnoCursorHelper
      67             : {
      68             :     //  keep Any's mapped by (WhichId << 16 ) + (MemberId)
      69             :     typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t;
      70        1254 :     class SwAnyMapHelper : public AnyMapHelper_t
      71             :     {
      72             :         public:
      73             :             ~SwAnyMapHelper();
      74             : 
      75             :             void    SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any& rAny );
      76             :             bool    FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any*& pAny );
      77             :     };
      78             : 
      79             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
      80             :         GetNestedTextContent(SwTxtNode & rTextNode, sal_Int32 const nIndex,
      81             :             bool const bParent);
      82             : 
      83             :     bool                    getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
      84             :                                         , SwPaM& rPam
      85             :                                         , com::sun::star::uno::Any *pAny
      86             :                                         , com::sun::star::beans::PropertyState& eState
      87             :                                         , const SwTxtNode* pNode = 0 );
      88             : 
      89             :     void                        GetCurPageStyle(SwPaM& rPaM, OUString &rString);
      90             : 
      91         292 :     inline sal_Bool             IsStartOfPara(SwPaM& rUnoCrsr)
      92         292 :                                         { return rUnoCrsr.GetPoint()->nContent == 0;}
      93         281 :     inline sal_Bool             IsEndOfPara(SwPaM& rUnoCrsr)
      94         562 :                                         { return rUnoCrsr.GetCntntNode() &&
      95         562 :                                             rUnoCrsr.GetPoint()->nContent == rUnoCrsr.GetCntntNode()->Len();}
      96             : 
      97             :     void                        resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam);
      98             :     void                        InsertFile(SwUnoCrsr* pUnoCrsr,
      99             :                                     const OUString& rURL,
     100             :                                     const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rOptions)
     101             :         throw (com::sun::star::lang::IllegalArgumentException,
     102             :                com::sun::star::io::IOException,
     103             :                com::sun::star::uno::RuntimeException,
     104             :                std::exception);
     105             : 
     106             :     void                        getNumberingProperty(
     107             :                                     SwPaM& rPam,
     108             :                                     com::sun::star::beans::PropertyState& eState,
     109             :                                     com::sun::star::uno::Any *pAny );
     110             : 
     111             :     void                        setNumberingProperty(
     112             :                                     const com::sun::star::uno::Any& rValue,
     113             :                                     SwPaM& rPam);
     114             : 
     115             :     sal_Int16                   IsNodeNumStart(
     116             :                                     SwPaM& rPam,
     117             :                                     com::sun::star::beans::PropertyState& eState);
     118             : 
     119             :     bool    DocInsertStringSplitCR(  SwDoc &rDoc,
     120             :                     const SwPaM &rNewCursor, const OUString &rText,
     121             :                     const bool bForceExpandHints );
     122             :     void    makeRedline( SwPaM& rPaM, const OUString& RedlineType,
     123             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
     124             :                 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     125             : 
     126             :     void    makeTableRowRedline( SwTableLine& rTableLine, const OUString& RedlineType,
     127             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
     128             :                 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     129             : 
     130             :     void    makeTableCellRedline( SwTableBox& rTableBox, const OUString& RedlineType,
     131             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
     132             :                 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     133             : 
     134             :     /// @param bTableMode: attributes should be applied to a table selection
     135             :     void SetCrsrAttr(SwPaM & rPam, const SfxItemSet & rSet,
     136             :                      const SetAttrMode nAttrMode,
     137             :                      const bool bTableMode = false);
     138             :     void GetCrsrAttr(SwPaM & rPam, SfxItemSet & rSet,
     139             :                      const bool bOnlyTxtAttr = false,
     140             :                      const bool bGetFromChrFmt = true);
     141             :     void GetTextFromPam(SwPaM & rPam, OUString & rBuffer);
     142             :     SwFmtColl * GetCurTxtFmtColl(SwPaM & rPam, const bool bConditional);
     143             : 
     144             :     void SelectPam(SwPaM & rPam, const bool bExpand);
     145             :     void SetString(SwCursor & rCursor, const OUString & rString);
     146             : 
     147             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
     148             :            CreateSortDescriptor(const bool bFromTable);
     149             :     sal_Bool ConvertSortProperties(
     150             :             const ::com::sun::star::uno::Sequence<
     151             :                 ::com::sun::star::beans::PropertyValue >& rDescriptor,
     152             :             SwSortOptions & rSortOpt);
     153             : 
     154             :     /// @param bTableMode: attributes should be applied to a table selection
     155             :     void SetPropertyValue(
     156             :             SwPaM& rPaM,
     157             :             const SfxItemPropertySet & rPropSet,
     158             :             const OUString & rPropertyName,
     159             :             const ::com::sun::star::uno::Any & rValue,
     160             :             const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
     161             :             const bool bTableMode = false)
     162             :         throw (::com::sun::star::beans::UnknownPropertyException,
     163             :                 ::com::sun::star::beans::PropertyVetoException,
     164             :                 ::com::sun::star::lang::IllegalArgumentException,
     165             :                 ::com::sun::star::lang::WrappedTargetException,
     166             :                 ::com::sun::star::uno::RuntimeException);
     167             :     /// @param bTableMode: attributes should be applied to a table selection
     168             :     void SetPropertyValues(
     169             :             SwPaM& rPaM,
     170             :             const SfxItemPropertySet & rPropSet,
     171             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &
     172             :             rPropertyValues,
     173             :             const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
     174             :             const bool bTableMode = false)
     175             :         throw (::com::sun::star::beans::UnknownPropertyException,
     176             :                 ::com::sun::star::beans::PropertyVetoException,
     177             :                 ::com::sun::star::lang::IllegalArgumentException,
     178             :                 ::com::sun::star::lang::WrappedTargetException,
     179             :                 ::com::sun::star::uno::RuntimeException);
     180             :     ::com::sun::star::uno::Any  GetPropertyValue(
     181             :             SwPaM& rPaM,
     182             :             const SfxItemPropertySet & rPropSet,
     183             :             const OUString & rPropertyName)
     184             :         throw (::com::sun::star::beans::UnknownPropertyException,
     185             :                 ::com::sun::star::lang::WrappedTargetException,
     186             :                 ::com::sun::star::uno::RuntimeException);
     187             :     ::com::sun::star::uno::Sequence<
     188             :                 ::com::sun::star::beans::PropertyState > GetPropertyStates(
     189             :             SwPaM & rPaM,
     190             :             const SfxItemPropertySet & rPropSet,
     191             :             const ::com::sun::star::uno::Sequence< OUString >&
     192             :                 rPropertyNames,
     193             :             const SwGetPropertyStatesCaller eCaller =
     194             :                 SW_PROPERTY_STATE_CALLER_DEFAULT)
     195             :         throw (::com::sun::star::beans::UnknownPropertyException,
     196             :                 ::com::sun::star::uno::RuntimeException);
     197             :     ::com::sun::star::beans::PropertyState GetPropertyState(
     198             :             SwPaM & rPaM,
     199             :             const SfxItemPropertySet & rPropSet,
     200             :             const OUString & rPropertyName)
     201             :         throw (::com::sun::star::beans::UnknownPropertyException,
     202             :                 ::com::sun::star::uno::RuntimeException);
     203             :     void SetPropertyToDefault(
     204             :             SwPaM & rPaM,
     205             :             const SfxItemPropertySet & rPropSet,
     206             :             const OUString & rPropertyName)
     207             :         throw (::com::sun::star::beans::UnknownPropertyException,
     208             :                 ::com::sun::star::uno::RuntimeException);
     209             :     ::com::sun::star::uno::Any  GetPropertyDefault(
     210             :             SwPaM & rPaM,
     211             :             const SfxItemPropertySet & rPropSet,
     212             :             const OUString & rPropertyName)
     213             :         throw (::com::sun::star::beans::UnknownPropertyException,
     214             :                 ::com::sun::star::lang::WrappedTargetException,
     215             :                 ::com::sun::star::uno::RuntimeException);
     216             : 
     217             :     bool SetPageDesc(
     218             :             const ::com::sun::star::uno::Any& rValue,
     219             :             SwDoc & rDoc, SfxItemSet & rSet);
     220             :     void SetTxtFmtColl(const ::com::sun::star::uno::Any & rAny, SwPaM & rPaM)
     221             :         throw (::com::sun::star::lang::IllegalArgumentException);
     222             :     bool SetCursorPropertyValue(
     223             :             SfxItemPropertySimpleEntry const& rEntry,
     224             :             ::com::sun::star::uno::Any const& rValue,
     225             :             SwPaM & rPam, SfxItemSet & rItemSet)
     226             :         throw (::com::sun::star::lang::IllegalArgumentException);
     227             : 
     228             :     /// try to get something that can be selected out of the XInterface
     229             :     /// at most one of the out parameters gets assigned a non-null value
     230             :     /// o_rpPaM is newly allocated and must be deleted; other parameters not
     231             :     SW_DLLPUBLIC void GetSelectableFromAny(
     232             :         ::com::sun::star::uno::Reference<
     233             :             ::com::sun::star::uno::XInterface> const& xIfc,
     234             :         SwDoc & rTargetDoc,
     235             :         SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
     236             :         OUString & o_rTableName, SwUnoTableCrsr const*& o_rpTableCursor,
     237             :         ::sw::mark::IMark const*& o_rpMark,
     238             :         std::vector<SdrObject *> & o_rSdrObjects);
     239             : 
     240             :     ::com::sun::star::uno::Reference<
     241             :         ::com::sun::star::text::XFlatParagraphIterator>
     242             :             CreateFlatParagraphIterator(SwDoc &, sal_Int32,  bool);
     243             : 
     244             : } // namespace SwUnoCursorHelper
     245             : 
     246             : #endif
     247             : 
     248             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10