[Libreoffice-commits] core.git: Branch 'feature/textbox' - 917 commits - accessibility/inc accessibility/source animations/source avmedia/Library_avmedia.mk avmedia/source basctl/inc basctl/source basic/inc basic/source binaryurp/source bin/findunusedcode bin/fixincludeguards.sh bin/lo-all-static-libs bin/update_pch.sh bridges/inc bridges/source canvas/source chart2/inc chart2/opengl chart2/Package_opengl.mk chart2/qa chart2/source cli_ure/source codemaker/source comphelper/inc comphelper/Library_comphelper.mk comphelper/source compilerplugins/clang compilerplugins/Makefile-clang.mk config_host.mk.in configmgr/inc configmgr/Library_configmgr.mk configmgr/source configure.ac connectivity/source cppcanvas/source cppuhelper/source cppuhelper/test cppu/source cpputools/source cui/source cui/uiconfig dbaccess/inc dbaccess/source desktop/Library_deploymentgui.mk desktop/source desktop/uiconfig desktop/UIConfig_deployment.mk desktop/unx download.lst drawinglayer/source dtrans/source editeng/source embed dedobj/source embedserv/source eventattacher/source extensions/inc extensions/source extensions/test external/apache-commons external/clucene external/coinmp external/collada2gltf external/cppunit external/freetype external/glew external/hyphen external/icu external/lcms2 external/libabw external/libcdr external/libebook external/libetonyek external/libfreehand external/libgltf external/liblangtag external/libmspub external/libmwaw external/libodfgen external/librevenge external/libvisio external/libwpd external/libwpg external/libwps external/Module_external.mk external/mysqlcppconn external/mythes external/opencollada external/openssl external/python3 extras/AllLangPackage_autotextshare.mk extras/source filter/qa filter/source forms/source formula/source fpicker/source framework/inc framework/qa framework/source helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/source icon-themes/galaxy idlc/inc idlc/source idl/source include/avmedia incl ude/canvas include/codemaker include/com include/comphelper include/editeng include/filter include/formula include/framework include/i18nlangtag include/oox include/osl include/rtl include/sal include/sfx2 include/svl include/svtools include/svx include/toolkit include/tools include/unoidl include/vbahelper include/vcl include/writerperfect instsetoo_native/CustomTarget_install.mk ios/CustomTarget_TiledLibreOffice_app.mk ios/experimental io/source io/test javaunohelper/source jvmaccess/source jvmfwk/plugins l10ntools/inc l10ntools/source leak-suppress.txt lingucomponent/source linguistic/source lotuswordpro/inc lotuswordpro/Library_lwpft.mk lotuswordpro/source Makefile.fetch mysqlc/source o3tl/qa odk/config odk/examples offapi/com officecfg/registry oovbaapi/ooo oox/README oox/source package/source postprocess/CustomTarget_registry.mk pyuno/inc pyuno/source registry/source remotebridges/source reportbuilder/java reportdesign/inc reportdesign/qa reportdesign/source RepositoryExternal .mk Repository.mk rsc/source sal/cppunittester sal/osl sal/qa sal/rtl sal/textenc sal/util sal/workben sax/source scaddins/source sc/inc sc/Library_sc.mk sc/qa scripting/source scripting/workben sc/sdi sc/source sc/uiconfig sdext/Library_pdfimport.mk sdext/source sd/inc sd/source sd/uiconfig sfx2/inc sfx2/source shell/source slideshow/Library_OGLTrans.mk slideshow/source solenv/bin solenv/gbuild solenv/gcc-wrappers soltools/cpp soltools/mkdepend sot/source starmath/inc starmath/source starmath/uiconfig stoc/inc stoc/source stoc/test svl/source svtools/source svx/Executable_pixelctl.mk svx/inc svx/Module_svx.mk svx/source svx/uiconfig svx/UIConfig_svx.mk svx/workben sw/CppunitTest_sw_macros_test.mk swext/Extension_wiki-publisher.mk sw/inc sw/Library_msword.mk sw/Library_sw.mk sw/qa sw/source sw/uiconfig sysui/CustomTarget_deb.mk test/source testtools/source toolkit/source tools/CustomTarget_reversemap.mk tools/inc tools/Library_tl.mk tools/qa tools/source translations ucbhelper/sourc e ucb/source ucb/workben udkapi/com UnoControls/source unoidl/README unoidl/source unotest/source unotools/source unoxml/inc unoxml/Library_unoxml.mk unoxml/source unusedcode.easy ure/source uui/source vbahelper/source vcl/android vcl/Executable_svdemo.mk vcl/Executable_svpclient.mk vcl/Executable_svptest.mk vcl/Executable_vcldemo.mk vcl/generic vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Module_vcl.mk vcl/osx vcl/qa vcl/quartz vcl/source vcl/unx vcl/win vcl/workben winaccessibility/source wizards/com wizards/source writerfilter/CustomTarget_source.mk writerfilter/inc writerfilter/source writerperfect/CppunitTest_writerperfect_stream.mk writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftimpress.mk writerperfect/Library_wpftwriter.mk writerperfect/Library_writerperfect.mk writerperfect/qa writerperfect/source xmlhelp/source xmloff/inc xmloff/Library_xof.mk xmloff/source xmlreader/source xmlscript/source xmlscript/test xmlsecurity/inc xmlsecurity/qa xmlsecurity/source

Miklos Vajna vmiklos at collabora.co.uk
Tue May 27 01:25:36 PDT 2014


Rebased ref, commits from common ancestor:
commit 301f5fcaaeb529f02a1ef61824e65f24b4871bbc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 14 11:36:35 2014 +0200

    WIP: oox: trigger the TextBox property on XML_txbx
    
    Change-Id: Ia3e69e61073cc915c4462c9d3fcfe07b75ac3fb3

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8c97b87..acc4c34 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -824,8 +824,7 @@ Reference< XShape > Shape::createAndInsert(
             }
             else if (mbTextBox)
             {
-                //No such property yet
-                //aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true));
+                aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true));
             }
 
             PropertySet( xSet ).setProperties( aShapeProps );
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index ed2b1de..cf7bb7e 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -116,7 +116,6 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
     case XML_txbx:
     {
         mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
-        mpShape->setServiceName("com.sun.star.text.TextFrame");
         mpShape->setTextBox(true);
         //in case if the textbox is linked, save the attributes
         //for further processing.
commit fa2b77275007c80130ef25a3b829faec36d45d0c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:08:33 2014 +0200

    SwXTextPortionEnumeration: do not expose inline anchored textboxes
    
    Change-Id: Id4aecd49e29f6aa8347be4d9e3e8f0e73f7c5a21

diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index c6a7bc4..887b84f 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -28,6 +28,7 @@
 #include <ndtxt.hxx>
 #include <unocrsr.hxx>
 #include <docary.hxx>
+#include <textboxhelper.hxx>
 #include <tox.hxx>
 #include <unomid.h>
 #include <unoparaframeenum.hxx>
@@ -43,6 +44,7 @@
 #include <fmtanchr.hxx>
 #include <fmtrfmrk.hxx>
 #include <frmfmt.hxx>
+#include <fmtflcnt.hxx>
 #include <unoidx.hxx>
 #include <unocoll.hxx>
 #include <redline.hxx>
@@ -687,7 +689,8 @@ lcl_ExportHints(
     const sal_Int32 nCurrentIndex,
     const bool bRightMoveForbidden,
     bool & o_rbCursorMoved,
-    sal_Int32 & o_rNextAttrPosition )
+    sal_Int32 & o_rNextAttrPosition,
+    std::list<SwFrmFmt*>& rTextBoxes)
 {
     // if the attribute has a dummy character, then xRef is set (except META)
     // otherwise, the portion for the attribute is inserted into rPortions!
@@ -856,6 +859,11 @@ lcl_ExportHints(
                         pUnoCrsr->Right(1,CRSR_SKIP_CHARS,false,false);
                         if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
                             break; // Robust #i81708 content in covered cells
+
+                        // Do not expose inline anchored textboxes.
+                        if (std::find(rTextBoxes.begin(), rTextBoxes.end(), pAttr->GetFlyCnt().GetFrmFmt()) != rTextBoxes.end())
+                            break;
+
                         pUnoCrsr->Exchange();
                         xRef = new SwXTextPortion( pUnoCrsr, xParent, PORTION_FRAME);
                     }
@@ -1234,6 +1242,8 @@ static void lcl_CreatePortions(
     PortionStack_t PortionStack;
     PortionStack.push( PortionList_t(&i_rPortions, (const SwTxtAttr *)0) );
 
+    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+
     bool bAtEnd( false );
     while (!bAtEnd) // every iteration consumes at least current character!
     {
@@ -1284,7 +1294,7 @@ static void lcl_CreatePortions(
             // N.B.: side-effects nNextAttrIndex, bCursorMoved; may move cursor
             xRef = lcl_ExportHints(PortionStack, i_xParentText, pUnoCrsr,
                         pHints, i_nStartPos, i_nEndPos, nCurrentIndex, bAtEnd,
-                        bCursorMoved, nNextAttrIndex);
+                        bCursorMoved, nNextAttrIndex, aTextBoxes);
             if (PortionStack.empty())
             {
                 OSL_FAIL("CreatePortions: stack underflow");
commit c09fc6cdc1a28376d7476fa88e07097b9efa1548
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:08:16 2014 +0200

    SwXFrameEnumeration: ignore textboxes
    
    Change-Id: I6b37e904898c8b57e619443035ca271b411f5f00

diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 3ecae22..a6e2831 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -49,6 +49,7 @@
 #include <unofield.hxx>
 #include <unoidx.hxx>
 #include <unoframe.hxx>
+#include <textboxhelper.hxx>
 #include <unofootnote.hxx>
 #include <vcl/svapp.hxx>
 #include <fmtcntnt.hxx>
@@ -1087,12 +1088,15 @@ SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
     ::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
     // #i104937#
     SwFrmFmt* pFmt( 0 );
+
+    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+
     for( sal_uInt16 i = 0; i < nSize; ++i )
 //    for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
     {
         // #i104937#
         pFmt = (*pFmts)[i];
-        if(pFmt->Which() != RES_FLYFRMFMT)
+        if(pFmt->Which() != RES_FLYFRMFMT || std::find(aTextBoxes.begin(), aTextBoxes.end(), pFmt) != aTextBoxes.end())
             continue;
         const SwNodeIndex* pIdx =  pFmt->GetCntnt().GetCntntIdx();
         if(!pIdx || !pIdx->GetNodes().IsDocNodes())
commit f084e3f00ce3ae867db9bf36980f641e110ddf7e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:08:00 2014 +0200

    SwXFrames::getByIndex: ignore textboxes
    
    Change-Id: I58a8c3cf5e0384f68a9259b3a1575a201436057e

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index bccd5dd..8bab97a 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1233,7 +1233,7 @@ public:
     /** Access to frames.
     Iterate over Flys - forr Basic-Collections. */
     sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
-    SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL);
+    SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false );
 
     // Copy formats in own arrays and return them.
     SwFrmFmt  *CopyFrmFmt ( const SwFrmFmt& );
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index c657db0..4755251 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -120,16 +120,25 @@ sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
 }
 
 /// @attention If you change this, also update SwXFrameEnumeration in unocoll.
-SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType )
+SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType, bool bIgnoreTextBoxes )
 {
     SwFrmFmts& rFmts = *GetSpzFrmFmts();
     SwFrmFmt* pRetFmt = 0;
     sal_uInt16 nSize = rFmts.size();
     const SwNodeIndex* pIdx;
     sal_uInt16 nCount = 0;
+
+    std::list<SwFrmFmt*> aTextBoxes;
+    if (bIgnoreTextBoxes)
+        aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
+
     for( sal_uInt16 i = 0; !pRetFmt && i < nSize; ++i )
     {
         SwFrmFmt* pFlyFmt = rFmts[ i ];
+
+        if (bIgnoreTextBoxes && std::find(aTextBoxes.begin(), aTextBoxes.end(), pFlyFmt) != aTextBoxes.end())
+            continue;
+
         if( RES_FLYFRMFMT == pFlyFmt->Which()
             && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
             && pIdx->GetNodes().IsDocNodes()
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index c73d91e..3ecae22 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1200,7 +1200,8 @@ uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
         throw uno::RuntimeException();
     if(nIndex < 0 || nIndex >= USHRT_MAX)
         throw IndexOutOfBoundsException();
-    SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType);
+    // Ignore TextBoxes for TextFrames.
+    SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM);
     if(!pFmt)
         throw IndexOutOfBoundsException();
     return lcl_UnoWrapFrame(pFmt, eType);
commit 42dbe1578906cac1bd23c928f6c59143cc7c4f47
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:07:43 2014 +0200

    SwXFrames::getCount: ignore TextFrames, which are TextBoxes
    
    Change-Id: I12d2912f566a31e36f6d091d554106b927abb9c9

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4e833d8..bccd5dd 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1232,7 +1232,7 @@ public:
 
     /** Access to frames.
     Iterate over Flys - forr Basic-Collections. */
-    sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL) const;
+    sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
     SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL);
 
     // Copy formats in own arrays and return them.
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index e306eb8..c657db0 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -42,6 +42,7 @@
 #include <pagefrm.hxx>
 #include <rootfrm.hxx>
 #include <flyfrms.hxx>
+#include <textboxhelper.hxx>
 #include <frmtool.hxx>
 #include <frmfmt.hxx>
 #include <ndtxt.hxx>
@@ -68,15 +69,24 @@
 
 using namespace ::com::sun::star;
 
-sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const
+sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
 {
     const SwFrmFmts& rFmts = *GetSpzFrmFmts();
     sal_uInt16 nSize = rFmts.size();
     sal_uInt16 nCount = 0;
     const SwNodeIndex* pIdx;
+
+    std::list<SwFrmFmt*> aTextBoxes;
+    if (bIgnoreTextBoxes)
+        aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
+
     for ( sal_uInt16 i = 0; i < nSize; i++)
     {
         const SwFrmFmt* pFlyFmt = rFmts[ i ];
+
+        if (bIgnoreTextBoxes && std::find(aTextBoxes.begin(), aTextBoxes.end(), pFlyFmt) != aTextBoxes.end())
+            continue;
+
         if( RES_FLYFRMFMT == pFlyFmt->Which()
             && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
             && pIdx->GetNodes().IsDocNodes()
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 6a6fb94..c73d91e 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1188,7 +1188,8 @@ sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException, std::exception)
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    return GetDoc()->GetFlyCount(eType);
+    // Ignore TextBoxes for TextFrames.
+    return GetDoc()->GetFlyCount(eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM);
 }
 
 uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
commit 09737b3860b6cd8b4649268b8acdc480e2ee46a4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:07:23 2014 +0200

    SwTextBoxHelper::findTextBox: only draw frames can have textboxes
    
    Change-Id: I4ff9f87120a9ba392aee205641e17c12cb30649b

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 36c302a..56b4e0e 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -143,13 +143,15 @@ SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
 {
     SwFrmFmt* pRet = 0;
 
-    if (pShape->GetAttrSet().HasItem(RES_CNTNT))
+    // Only draw frames can have TextBoxes.
+    if (pShape->Which() == RES_DRAWFRMFMT && pShape->GetAttrSet().HasItem(RES_CNTNT))
     {
         const SwFmtCntnt& rCntnt = pShape->GetCntnt();
         SwFrmFmts& rSpzFrmFmts = *pShape->GetDoc()->GetSpzFrmFmts();
         for (SwFrmFmts::iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
         {
             SwFrmFmt* pFmt = *it;
+            // Only a fly frame can be a TextBox.
             if (pFmt->Which() == RES_FLYFRMFMT && pFmt->GetAttrSet().HasItem(RES_CNTNT) && pFmt->GetCntnt() == rCntnt)
             {
                 pRet = pFmt;
commit 9d410acdff838c30059dbe360b9a2b63cdb221fd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:07:06 2014 +0200

    let SwTextBoxHelper::findTextBoxes() take a const SwDoc
    
    Change-Id: Icb1540b93f4117999b755d4d5fd387f1228250aa

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index d3532c0..28f8d71 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -41,7 +41,7 @@ public:
     static SwFrmFmt* findTextBox(SwFrmFmt* pShape);
 
     /// Look up TextFrames in a document, which are in fact TextBoxes.
-    static std::list<SwFrmFmt*> findTextBoxes(SwDoc* pDoc);
+    static std::list<SwFrmFmt*> findTextBoxes(const SwDoc* pDoc);
     /// Count number of shapes in the document, excluding TextBoxes.
     static sal_Int32 getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes);
     /// Get a shape by index, excluding TextBoxes.
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index d2cd4d7..36c302a 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -83,12 +83,12 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
     }
 }
 
-std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(SwDoc* pDoc)
+std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc)
 {
     std::list<SwFrmFmt*> aRet;
 
-    SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
-    for (SwFrmFmts::iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
+    const SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
+    for (SwFrmFmts::const_iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
     {
         SwFrmFmt* pTextBox = findTextBox(*it);
         if (pTextBox)
commit 95b0c887b138b639248fe6e993352e9d0b567fd2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:06:48 2014 +0200

    SwXParaFrameEnumeration: ignore textboxes
    
    Change-Id: Ia4441a06c29447d4a4f4cbe6250248a0f68831f1

diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index cc43ec6..4660ce1 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -27,6 +27,7 @@
 #include <frmfmt.hxx>
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
+#include <textboxhelper.hxx>
 #include <ndtxt.hxx>
 #include <ndnotxt.hxx>
 #include <unocrsr.hxx>
@@ -181,10 +182,17 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
     {
         const SwSortedObjs *pObjs = pCFrm->GetDrawObjs();
         if( pObjs )
+        {
+            std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
             for( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
             {
                 SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
                 SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
+
+                // Filter out textboxes, which are not interesting at an UNO level.
+                if (std::find(aTextBoxes.begin(), aTextBoxes.end(), &rFmt) != aTextBoxes.end())
+                    continue;
+
                 if ( rFmt.GetAnchor().GetAnchorId() == nChkType )
                 {
                     // create SwDepend and insert into array
@@ -199,6 +207,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
                     rFrames.push_back(entry);
                 }
             }
+        }
     }
     else
     {
commit 53149e1ea9b93d0816638bd22a05385552cc364f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:06:29 2014 +0200

    SwXDrawPage::getByIndex(): ignore textboxes
    
    Change-Id: I643ca4268e15af1882adb168af152835ef216cd9

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index bac2dcc..d3532c0 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -14,6 +14,7 @@
 
 #include <com/sun/star/uno/Any.h>
 #include <com/sun/star/uno/Type.h>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 
 class SdrPage;
 class SwFrmFmt;
@@ -43,6 +44,8 @@ public:
     static std::list<SwFrmFmt*> findTextBoxes(SwDoc* pDoc);
     /// Count number of shapes in the document, excluding TextBoxes.
     static sal_Int32 getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes);
+    /// Get a shape by index, excluding TextBoxes.
+    static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list<SwFrmFmt*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException);
 };
 
 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 4671580..d2cd4d7 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -98,19 +98,47 @@ std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(SwDoc* pDoc)
     return aRet;
 }
 
+/// If the passed SdrObject is in fact a TextFrame, that is used as a TextBox.
+bool lcl_isTextBox(SdrObject* pSdrObject, std::list<SwFrmFmt*>& rTextBoxes)
+{
+    SwVirtFlyDrawObj* pObject = PTR_CAST(SwVirtFlyDrawObj, pSdrObject);
+    return pObject && std::find(rTextBoxes.begin(), rTextBoxes.end(), pObject->GetFmt()) != rTextBoxes.end();
+}
+
 sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes)
 {
     sal_Int32 nRet = 0;
     for (size_t i = 0; i < pPage->GetObjCount(); ++i)
     {
-        SwVirtFlyDrawObj* pObject = PTR_CAST(SwVirtFlyDrawObj, pPage->GetObj(i));
-        if (pObject && std::find(rTextBoxes.begin(), rTextBoxes.end(), pObject->GetFmt()) != rTextBoxes.end())
+        if (lcl_isTextBox(pPage->GetObj(i), rTextBoxes))
             continue;
         ++nRet;
     }
     return nRet;
 }
 
+uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list<SwFrmFmt*>& rTextBoxes) throw(lang::IndexOutOfBoundsException)
+{
+    if (nIndex < 0 || nIndex >= getCount(pPage, rTextBoxes))
+        throw lang::IndexOutOfBoundsException();
+
+    SdrObject* pRet = 0;
+    sal_Int32 nCount = 0; // Current logical index.
+    for (size_t i = 0; i < pPage->GetObjCount(); ++i)
+    {
+        if (lcl_isTextBox(pPage->GetObj(i), rTextBoxes))
+            continue;
+        if (nCount == nIndex)
+        {
+            pRet = pPage->GetObj(i);
+            break;
+        }
+        ++nCount;
+    }
+    assert(pRet);
+    return uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY));
+}
+
 SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
 {
     SwFrmFmt* pRet = 0;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index c720e99..2b122ec 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -538,7 +538,11 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
         throw lang::IndexOutOfBoundsException();
 
     ((SwXDrawPage*)this)->GetSvxPage();
-    return pDrawPage->getByIndex( nIndex );
+    std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+    if (aTextBoxes.empty())
+        return pDrawPage->getByIndex( nIndex );
+    else
+        return SwTextBoxHelper::getByIndex(pDrawPage->GetSdrPage(), nIndex, aTextBoxes);
 }
 
 uno::Type  SwXDrawPage::getElementType(void) throw( uno::RuntimeException, std::exception )
commit 6a681988465ac1fc0488142d547e9647ba694123
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:06:11 2014 +0200

    SwXDrawPage::getCount(): ignore textboxes
    
    Change-Id: I579cc0242f6901175162b169813e4465d52952a0

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index f7750b3..bac2dcc 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -10,10 +10,14 @@
 #ifndef INCLUDED_SW_INC_TEXTBOXHELPER_HXX
 #define INCLUDED_SW_INC_TEXTBOXHELPER_HXX
 
+#include <list>
+
 #include <com/sun/star/uno/Any.h>
 #include <com/sun/star/uno/Type.h>
 
+class SdrPage;
 class SwFrmFmt;
+class SwDoc;
 
 /**
  * A TextBox is a TextFrame, that is tied to a drawinglayer shape.
@@ -34,6 +38,11 @@ public:
     static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const OUString& rPropertyName, const css::uno::Any& rValue);
     /// If we have an associated TextFrame, then return that.
     static SwFrmFmt* findTextBox(SwFrmFmt* pShape);
+
+    /// Look up TextFrames in a document, which are in fact TextBoxes.
+    static std::list<SwFrmFmt*> findTextBoxes(SwDoc* pDoc);
+    /// Count number of shapes in the document, excluding TextBoxes.
+    static sal_Int32 getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes);
 };
 
 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 85b18b9..4671580 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -18,9 +18,11 @@
 #include <unotextbodyhf.hxx>
 #include <unotextrange.hxx>
 #include <unomid.h>
+#include <dflyobj.hxx>
 
 #include <svx/svdoashp.hxx>
 #include <svx/unopage.hxx>
+#include <svx/svdpage.hxx>
 
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/text/SizeType.hpp>
@@ -81,6 +83,34 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
     }
 }
 
+std::list<SwFrmFmt*> SwTextBoxHelper::findTextBoxes(SwDoc* pDoc)
+{
+    std::list<SwFrmFmt*> aRet;
+
+    SwFrmFmts& rSpzFrmFmts = *pDoc->GetSpzFrmFmts();
+    for (SwFrmFmts::iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
+    {
+        SwFrmFmt* pTextBox = findTextBox(*it);
+        if (pTextBox)
+            aRet.push_back(pTextBox);
+    }
+
+    return aRet;
+}
+
+sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::list<SwFrmFmt*>& rTextBoxes)
+{
+    sal_Int32 nRet = 0;
+    for (size_t i = 0; i < pPage->GetObjCount(); ++i)
+    {
+        SwVirtFlyDrawObj* pObject = PTR_CAST(SwVirtFlyDrawObj, pPage->GetObj(i));
+        if (pObject && std::find(rTextBoxes.begin(), rTextBoxes.end(), pObject->GetFmt()) != rTextBoxes.end())
+            continue;
+        ++nRet;
+    }
+    return nRet;
+}
+
 SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
 {
     SwFrmFmt* pRet = 0;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index b01ae9c..c720e99 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -30,6 +30,7 @@
 #include <swunohelper.hxx>
 #include <textboxhelper.hxx>
 #include <doc.hxx>
+#include <docary.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <fmtcntnt.hxx>
 #include <fmtflcnt.hxx>
@@ -516,7 +517,13 @@ sal_Int32 SwXDrawPage::getCount(void) throw( uno::RuntimeException, std::excepti
     else
     {
         ((SwXDrawPage*)this)->GetSvxPage();
-        return pDrawPage->getCount();
+
+        std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+
+        if (aTextBoxes.empty())
+            return pDrawPage->getCount();
+        else
+            return SwTextBoxHelper::getCount(pDrawPage->GetSdrPage(), aTextBoxes);
     }
 }
 
commit 89cdeaa23fc51ee04b4b37ce03c72e122410ddd7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:05:55 2014 +0200

    SwXShape: return the right XText implementaation in the TextBox case
    
    Change-Id: Iac31bd4b3b1918f857feff9045df473e9b1d3d2b

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 0c992dc..f7750b3 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -28,8 +28,8 @@ public:
     static void create(SwFrmFmt* pShape);
     /// Destroy a TextBox for a shape.
     static void destroy(SwFrmFmt* pShape);
-    /// Get XTextAppend of a shape's TextBox, if there is any.
-    static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType);
+    /// Get interface of a shape's TextBox, if there is any.
+    static css::uno::Any queryInterface(SwFrmFmt* pShape, const css::uno::Type& rType);
     /// Sync property of TextBox with the one of the shape.
     static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const OUString& rPropertyName, const css::uno::Any& rValue);
     /// If we have an associated TextFrame, then return that.
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index faadb5f..85b18b9 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -103,18 +103,29 @@ SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
     return pRet;
 }
 
-uno::Any SwTextBoxHelper::getXTextAppend(SwFrmFmt* pShape, const uno::Type& rType)
+template < typename T >
+void lcl_queryInterface(SwFrmFmt* pShape, uno::Any& rAny)
+{
+    if (SwFrmFmt* pFmt = SwTextBoxHelper::findTextBox(pShape))
+    {
+        uno::Reference<T> xInterface(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
+        rAny <<= xInterface;
+    }
+}
+
+uno::Any SwTextBoxHelper::queryInterface(SwFrmFmt* pShape, const uno::Type& rType)
 {
     uno::Any aRet;
 
     if (rType == cppu::UnoType<css::text::XTextAppend>::get())
     {
-        if (SwFrmFmt* pFmt = findTextBox(pShape))
-        {
-            uno::Reference<text::XTextAppend> xTextAppend(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
-            aRet <<= xTextAppend;
-        }
+        lcl_queryInterface<text::XTextAppend>(pShape, aRet);
     }
+    else if (rType == cppu::UnoType<css::text::XText>::get())
+    {
+        lcl_queryInterface<text::XText>(pShape, aRet);
+    }
+
 
     return aRet;
 }
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index e506cd2..b01ae9c 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -975,7 +975,7 @@ SwXShape::~SwXShape()
 
 uno::Any SwXShape::queryInterface( const uno::Type& aType ) throw( uno::RuntimeException, std::exception )
 {
-    uno::Any aRet = SwTextBoxHelper::getXTextAppend(GetFrmFmt(), aType);
+    uno::Any aRet = SwTextBoxHelper::queryInterface(GetFrmFmt(), aType);
     if (aRet.hasValue())
         return aRet;
 
commit 08781eda329fbd83034ce8b33bfdf0dd4f601045
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:05:36 2014 +0200

    SwXShape: allow setting TextBox property to false
    
    Change-Id: I23d79fc3f5c020c86296bfc84bb0824e1ca68228

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 93a459d..0c992dc 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -26,6 +26,8 @@ class SwTextBoxHelper
 public:
     /// Create a TextBox for a shape.
     static void create(SwFrmFmt* pShape);
+    /// Destroy a TextBox for a shape.
+    static void destroy(SwFrmFmt* pShape);
     /// Get XTextAppend of a shape's TextBox, if there is any.
     static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType);
     /// Sync property of TextBox with the one of the shape.
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 9937778..faadb5f 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -65,6 +65,22 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape)
     }
 }
 
+void SwTextBoxHelper::destroy(SwFrmFmt* pShape)
+{
+    // If a TextBox was enabled previously
+    if (pShape->GetAttrSet().HasItem(RES_CNTNT))
+    {
+        SwFrmFmt* pFmt = findTextBox(pShape);
+
+        // Unlink the TextBox's text range from the original shape.
+        pShape->ResetFmtAttr(RES_CNTNT);
+
+        // Delete the associated TextFrame.
+        if (pFmt)
+            pShape->GetDoc()->DelLayoutFmt(pFmt);
+    }
+}
+
 SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
 {
     SwFrmFmt* pRet = 0;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 1c03330..e506cd2 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1182,9 +1182,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                 {
                     bool bValue;
                     aValue >>= bValue;
-                    // If TextBox is to be enabled.
                     if (bValue)
                         SwTextBoxHelper::create(pFmt);
+                    else
+                        SwTextBoxHelper::destroy(pFmt);
 
                 }
                 // #i28749#
commit 73ac7fff22a400449f8398c85a27eeb1ac0700e2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:05:16 2014 +0200

    SwTextBoxHelper::syncProperty(): avoid crash on not-yet-inserted shape
    
    Change-Id: I3308ba685b4066ea6849e8002e9d98cc5264c368

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index ec27548..9937778 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -105,6 +105,10 @@ uno::Any SwTextBoxHelper::getXTextAppend(SwFrmFmt* pShape, const uno::Type& rTyp
 
 void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, const OUString& rPropertyName, const css::uno::Any& rValue)
 {
+    // No shape yet? Then nothing to do, initial properties are set by create().
+    if (!pShape)
+        return;
+
     uno::Any aValue(rValue);
     nMemberId &= ~CONVERT_TWIPS;
 
commit d5b1e34cc47343cb8a7f4869e472370649701e45
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:04:57 2014 +0200

    SwXShape: new bool TextBox property
    
    Change-Id: Iae588c817ea17b6b2c2d3f2818ee5f94ed6f4e96

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 8f49675..2d3ae39 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -855,6 +855,7 @@
 #define FN_SHAPE_STARTPOSITION_IN_HORI_L2R (FN_PARAM2+25)
 #define FN_SHAPE_ENDPOSITION_IN_HORI_L2R   (FN_PARAM2+26)
 #define FN_PARAM_PAM                    (FN_PARAM2+27) /* Point and Mark */
+#define FN_TEXT_BOX                     (FN_PARAM2+28) /* TextBox Property*/
 
 /*--------------------------------------------------------------------
     Description: Status: not more than 19!
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 65ba9cf..93a459d 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -30,6 +30,8 @@ public:
     static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType);
     /// Sync property of TextBox with the one of the shape.
     static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const OUString& rPropertyName, const css::uno::Any& rValue);
+    /// If we have an associated TextFrame, then return that.
+    static SwFrmFmt* findTextBox(SwFrmFmt* pShape);
 };
 
 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 63dfe4a..bed1254 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -65,6 +65,7 @@
 #define UNO_NAME_FOOTER_LEFT_MARGIN "FooterLeftMargin"
 #define UNO_NAME_FOOTER_RIGHT_MARGIN "FooterRightMargin"
 #define UNO_NAME_TEXT_RANGE "TextRange"
+#define UNO_NAME_TEXT_BOX "TextBox"
 #define UNO_NAME_NAME "Name"
 #define UNO_NAME_NUMBERING_ALIGNMENT "NumberingAlignment"
 #define UNO_NAME_BULLET_FONT_NAME "BulletFontName"
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index d7702f7..ec27548 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -65,8 +65,7 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape)
     }
 }
 
-// If we have an associated TextFrame, then return that.
-SwFrmFmt* lcl_findTextBox(SwFrmFmt* pShape)
+SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
 {
     SwFrmFmt* pRet = 0;
 
@@ -94,7 +93,7 @@ uno::Any SwTextBoxHelper::getXTextAppend(SwFrmFmt* pShape, const uno::Type& rTyp
 
     if (rType == cppu::UnoType<css::text::XTextAppend>::get())
     {
-        if (SwFrmFmt* pFmt = lcl_findTextBox(pShape))
+        if (SwFrmFmt* pFmt = findTextBox(pShape))
         {
             uno::Reference<text::XTextAppend> xTextAppend(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
             aRet <<= xTextAppend;
@@ -109,7 +108,7 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8
     uno::Any aValue(rValue);
     nMemberId &= ~CONVERT_TWIPS;
 
-    if (SwFrmFmt* pFmt = lcl_findTextBox(pShape))
+    if (SwFrmFmt* pFmt = findTextBox(pShape))
     {
         bool bSync = false;
         bool bAdjustX = false;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 20a14cf..1c03330 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1178,6 +1178,15 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                         delete pInternalPam;
                     }
                 }
+                else if (pEntry->nWID == FN_TEXT_BOX)
+                {
+                    bool bValue;
+                    aValue >>= bValue;
+                    // If TextBox is to be enabled.
+                    if (bValue)
+                        SwTextBoxHelper::create(pFmt);
+
+                }
                 // #i28749#
                 else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
                 {
@@ -1500,6 +1509,11 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                         }
                     }
                 }
+                else if (pEntry->nWID == FN_TEXT_BOX)
+                {
+                    bool bValue = SwTextBoxHelper::findTextBox(pFmt);
+                    aRet <<= bValue;
+                }
                 // #i28749#
                 else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry->nWID )
                 {
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index b2fb907..5a9cb5a 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1394,6 +1394,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { OUString(UNO_NAME_RELATIVE_HEIGHT_RELATION), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get(),      PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT_RELATION },
                     { OUString(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE,      cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH  },
                     { OUString(UNO_NAME_RELATIVE_WIDTH_RELATION), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get(),       PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH_RELATION },
+                    { OUString(UNO_NAME_TEXT_BOX), FN_TEXT_BOX, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
                     { OUString(), 0, css::uno::Type(), 0, 0 }
                 };
                 aMapEntriesArr[nPropertyId] = aShapeMap_Impl;
commit 3d2c845bdedd01d4e2c400004d59a73698920ed1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:04:23 2014 +0200

    SwXShape: invoke SwTextBoxHelper
    
    For now, only in queryInterface(), setPropertyValue() and setSize().
    It's safe to always call these methods, if they are not relevant, the
    method will be a NOP.
    
    Change-Id: I6efb808f605d47f731819cd971bb66ca251cafb6

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index ec4e021..b84e9fc 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -202,6 +202,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/doc/tblafmt \
     sw/source/core/doc/tblcpy \
     sw/source/core/doc/tblrwcl \
+    sw/source/core/doc/textboxhelper \
     sw/source/core/doc/visiturl \
     sw/source/core/docnode/cancellablejob \
     sw/source/core/docnode/finalthreadmanager \
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 19b1c5a..20a14cf 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -28,6 +28,7 @@
 #include <unotextrange.hxx>
 #include <svx/svditer.hxx>
 #include <swunohelper.hxx>
+#include <textboxhelper.hxx>
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <fmtcntnt.hxx>
@@ -974,7 +975,11 @@ SwXShape::~SwXShape()
 
 uno::Any SwXShape::queryInterface( const uno::Type& aType ) throw( uno::RuntimeException, std::exception )
 {
-    uno::Any aRet = SwXShapeBaseClass::queryInterface(aType);
+    uno::Any aRet = SwTextBoxHelper::getXTextAppend(GetFrmFmt(), aType);
+    if (aRet.hasValue())
+        return aRet;
+
+    aRet = SwXShapeBaseClass::queryInterface(aType);
     // #i53320# - follow-up of #i31698#
     // interface drawing::XShape is overloaded. Thus, provide
     // correct object instance.
@@ -1325,6 +1330,8 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                     else
                         pFmt->SetFmtAttr(aSet);
                 }
+                // We have a pFmt and a pEntry as well: try to sync TextBox property.
+                SwTextBoxHelper::syncProperty(pFmt, pEntry->nWID, pEntry->nMemberId, rPropertyName, aValue);
             }
             else
             {
@@ -2309,6 +2316,7 @@ void SAL_CALL SwXShape::setSize( const awt::Size& aSize )
     {
         mxShape->setSize( aSize );
     }
+    SwTextBoxHelper::syncProperty(GetFrmFmt(), RES_FRM_SIZE, MID_FRMSIZE_SIZE, "Size", uno::makeAny(aSize));
 }
 // #i31698#
 // implementation of virtual methods from drawing::XShapeDescriptor
commit eb25b50d5bb9d4e602a4b3b3aa8722a4f87c86a1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 27 09:03:51 2014 +0200

    Initial SwTextBoxHelper
    
    Change-Id: I2674d72a2ba7bf49f102e09ed8435445c9687bb2

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
new file mode 100644
index 0000000..65ba9cf
--- /dev/null
+++ b/sw/inc/textboxhelper.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SW_INC_TEXTBOXHELPER_HXX
+#define INCLUDED_SW_INC_TEXTBOXHELPER_HXX
+
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Type.h>
+
+class SwFrmFmt;
+
+/**
+ * A TextBox is a TextFrame, that is tied to a drawinglayer shape.
+ *
+ * This class provides helper methods to create, query and maintain such
+ * TextBoxes.
+ */
+class SwTextBoxHelper
+{
+public:
+    /// Create a TextBox for a shape.
+    static void create(SwFrmFmt* pShape);
+    /// Get XTextAppend of a shape's TextBox, if there is any.
+    static css::uno::Any getXTextAppend(SwFrmFmt* pShape, const css::uno::Type& rType);
+    /// Sync property of TextBox with the one of the shape.
+    static void syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const OUString& rPropertyName, const css::uno::Any& rValue);
+};
+
+#endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
new file mode 100644
index 0000000..d7702f7
--- /dev/null
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <textboxhelper.hxx>
+#include <frmfmt.hxx>
+#include <fmtcntnt.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <unocoll.hxx>
+#include <unoframe.hxx>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <unomid.h>
+
+#include <svx/svdoashp.hxx>
+#include <svx/unopage.hxx>
+
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+using namespace com::sun::star;
+
+void SwTextBoxHelper::create(SwFrmFmt* pShape)
+{
+    // If TextBox wasn't enabled previously
+    if (!pShape->GetAttrSet().HasItem(RES_CNTNT))
+    {
+        // Create the associated TextFrame and insert it into the document.
+        uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SW_SERVICE_TYPE_TEXTFRAME, pShape->GetDoc()), uno::UNO_QUERY);
+        uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+        uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY);
+        xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
+
+        // Initialize properties.
+        uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
+        uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2());
+        xPropertySet->setPropertyValue("TopBorder", aEmptyBorder);
+        xPropertySet->setPropertyValue("BottomBorder", aEmptyBorder);
+        xPropertySet->setPropertyValue("LeftBorder", aEmptyBorder);
+        xPropertySet->setPropertyValue("RightBorder", aEmptyBorder);
+
+        xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100)));
+
+        xPropertySet->setPropertyValue("SizeType", uno::makeAny(text::SizeType::FIX));
+
+        // Link its text range to the original shape.
+        uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW);
+        SwUnoInternalPaM aInternalPaM(*pShape->GetDoc());
+        if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox))
+        {
+            SwAttrSet aSet(pShape->GetAttrSet());
+            SwFmtCntnt aCntnt(aInternalPaM.GetNode()->StartOfSectionNode());
+            aSet.Put(aCntnt);
+            pShape->SetFmtAttr(aSet);
+        }
+    }
+}
+
+// If we have an associated TextFrame, then return that.
+SwFrmFmt* lcl_findTextBox(SwFrmFmt* pShape)
+{
+    SwFrmFmt* pRet = 0;
+
+    if (pShape->GetAttrSet().HasItem(RES_CNTNT))
+    {
+        const SwFmtCntnt& rCntnt = pShape->GetCntnt();
+        SwFrmFmts& rSpzFrmFmts = *pShape->GetDoc()->GetSpzFrmFmts();
+        for (SwFrmFmts::iterator it = rSpzFrmFmts.begin(); it != rSpzFrmFmts.end(); ++it)
+        {
+            SwFrmFmt* pFmt = *it;
+            if (pFmt->Which() == RES_FLYFRMFMT && pFmt->GetAttrSet().HasItem(RES_CNTNT) && pFmt->GetCntnt() == rCntnt)
+            {
+                pRet = pFmt;
+                break;
+            }
+        }
+    }
+
+    return pRet;
+}
+
+uno::Any SwTextBoxHelper::getXTextAppend(SwFrmFmt* pShape, const uno::Type& rType)
+{
+    uno::Any aRet;
+
+    if (rType == cppu::UnoType<css::text::XTextAppend>::get())
+    {
+        if (SwFrmFmt* pFmt = lcl_findTextBox(pShape))
+        {
+            uno::Reference<text::XTextAppend> xTextAppend(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
+            aRet <<= xTextAppend;
+        }
+    }
+
+    return aRet;
+}
+
+void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, const OUString& rPropertyName, const css::uno::Any& rValue)
+{
+    uno::Any aValue(rValue);
+    nMemberId &= ~CONVERT_TWIPS;
+
+    if (SwFrmFmt* pFmt = lcl_findTextBox(pShape))
+    {
+        bool bSync = false;
+        bool bAdjustX = false;
+        bool bAdjustY = false;
+        bool bAdjustSize = false;
+        switch (nWID)
+        {
+        case RES_HORI_ORIENT:
+            switch (nMemberId)
+            {
+            case MID_HORIORIENT_ORIENT:
+            case MID_HORIORIENT_RELATION:
+                bSync = true;
+                break;
+            case MID_HORIORIENT_POSITION:
+                bSync = true;
+                bAdjustX = true;
+                break;
+            }
+            break;
+        case RES_VERT_ORIENT:
+            switch (nMemberId)
+            {
+            case MID_VERTORIENT_ORIENT:
+            case MID_VERTORIENT_RELATION:
+                bSync = true;
+                break;
+            case MID_VERTORIENT_POSITION:
+                bSync = true;
+                bAdjustY = true;
+                break;
+            }
+            break;
+        case RES_FRM_SIZE:
+            bSync = true;
+            bAdjustSize = true;
+            break;
+        }
+
+        if (bSync)
+        {
+            // Position/size should be the text position/size, not the shape one as-is.
+            if (bAdjustX || bAdjustY || bAdjustSize)
+            {
+                SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
+                if (pCustomShape)
+                {
+                    Rectangle aRect;
+                    pCustomShape->GetTextBounds(aRect);
+
+                    if (bAdjustX || bAdjustY)
+                    {
+                        sal_Int32 nValue;
+                        if (aValue >>= nValue)
+                        {
+                            if (bAdjustX)
+                                nValue = TWIPS_TO_MM(aRect.getX());
+                            else if (bAdjustY)
+                                nValue = TWIPS_TO_MM(aRect.getY());
+                            aValue <<= nValue;
+                        }
+                    }
+                    else if (bAdjustSize)
+                    {
+                        awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()), TWIPS_TO_MM(aRect.getHeight()));
+                        aValue <<= aSize;
+                    }
+                }
+            }
+
+            uno::Reference<beans::XPropertySet> xPropertySet(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
+            xPropertySet->setPropertyValue(rPropertyName, aValue);
+        }
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a1dedadbf0d87a1db24e9b336257678e059882f0
Author: Eike Rathke <erack at redhat.com>
Date:   Tue May 27 01:34:37 2014 +0200

    resolved fdo#79228 resync ScPatternAttr if changed in GetNeededSize()
    
    Change-Id: Ida47df6223a20939ad5971dc00b8f3462a92dd3e

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 08e3c5a..9b6464b 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -206,6 +206,7 @@ class ScAttrIterator
 public:
     inline              ScAttrIterator( const ScAttrArray* pNewArray, SCROW nStart, SCROW nEnd );
     inline const ScPatternAttr* Next( SCROW& rTop, SCROW& rBottom );
+    inline const ScPatternAttr* Resync( SCROW nRow, SCROW& rTop, SCROW& rBottom );
     SCROW               GetNextRow() const { return nRow; }
 };
 
@@ -236,6 +237,26 @@ inline const ScPatternAttr* ScAttrIterator::Next( SCROW& rTop, SCROW& rBottom )
     return pRet;
 }
 
+inline const ScPatternAttr* ScAttrIterator::Resync( SCROW nRowP, SCROW& rTop, SCROW& rBottom )
+{
+    nRow = nRowP;
+    // Chances are high that the pattern changed on nRowP introduced a span
+    // starting right there. Assume that Next() was called so nPos already
+    // advanced. Another high chance is that the change extended a previous or
+    // next pattern. In all these cases we don't need to search.
+    if (3 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-3].nRow < nRowP &&
+            nRowP <= pArray->pData[nPos-2].nRow)
+        nPos -= 2;
+    else if (2 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-2].nRow < nRowP &&
+            nRowP <= pArray->pData[nPos-1].nRow)
+        --nPos;
+    else if (pArray->nCount > 0 && nRowP <= pArray->pData[0].nRow)
+        nPos = 0;
+    else
+        pArray->Search( nRowP, nPos );
+    return Next( rTop, rBottom);
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4212056..547fd14 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -445,7 +445,7 @@ public:
     long GetNeededSize(
         SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
         const Fraction& rZoomX, const Fraction& rZoomY,
-        bool bWidth, const ScNeededSizeOptions& rOptions) const;
+        bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange ) const;
 
     sal_uInt16 GetOptimalColWidth(
         OutputDevice* pDev, double nPPTX, double nPPTY,
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 7e5a4a6..763e658 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -86,7 +86,8 @@ inline bool IsAmbiguousScript( sal_uInt8 nScript )
 long ScColumn::GetNeededSize(
     SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
     const Fraction& rZoomX, const Fraction& rZoomY,
-    bool bWidth, const ScNeededSizeOptions& rOptions ) const
+    bool bWidth, const ScNeededSizeOptions& rOptions,
+    const ScPatternAttr** ppPatternChange ) const
 {
     std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow);
     sc::CellStoreType::const_iterator it = aPos.first;
@@ -148,9 +149,32 @@ long ScColumn::GetNeededSize(
     SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
     sal_uLong nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
     // #i111387# disable automatic line breaks only for "General" number format
-    if (bBreak && aCell.hasNumeric() && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
+    if (bBreak && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
     {
-        bBreak = false;
+        // If a formula cell needs to be interpreted during aCell.hasNumeric()
+        // to determine the type, the pattern may get invalidated because the
+        // result may set a number format. In which case there's also the
+        // General format not set anymore..
+        bool bMayInvalidatePattern = (aCell.meType == CELLTYPE_FORMULA);
+        const ScPatternAttr* pOldPattern = pPattern;
+        bool bNumeric = aCell.hasNumeric();
+        if (bMayInvalidatePattern)
+        {
+            pPattern = pAttrArray->GetPattern( nRow );
+            if (ppPatternChange)
+                *ppPatternChange = pPattern;    // XXX caller may have to check for change!
+        }
+        if (bNumeric)
+        {
+            if (!bMayInvalidatePattern || pPattern == pOldPattern)
+                bBreak = false;
+            else
+            {
+                nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
+                if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+                    bBreak = false;
+            }
+        }
     }
 
     //  get other attributes from pattern and conditional formatting
@@ -689,9 +713,9 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
                     const ScPatternAttr* pPattern = GetPattern(nRow);
                     aOptions.pPattern = pPattern;
                     aOptions.bGetFont = (pPattern != pOldPattern || nScript != nOldScript);
-                    sal_uInt16 nThis = (sal_uInt16) GetNeededSize(
-                        nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, true, aOptions);
                     pOldPattern = pPattern;
+                    sal_uInt16 nThis = (sal_uInt16) GetNeededSize(
+                        nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, true, aOptions, &pOldPattern);
                     if (nThis)
                     {
                         if (nThis > nWidth || !bFound)
@@ -763,7 +787,6 @@ void ScColumn::GetOptimalHeight(
     //  with conditional formatting, always consider the individual cells
 
     const ScPatternAttr* pPattern = aIter.Next(nStart,nEnd);
-    ::boost::ptr_vector<ScPatternAttr> aAltPatterns;
     while ( pPattern )
     {
         const ScMergeAttr*      pMerge = (const ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE);
@@ -902,11 +925,19 @@ void ScColumn::GetOptimalHeight(
                         if (rCxt.isForceAutoSize() || !(pDocument->GetRowFlags(nRow, nTab) & CR_MANUALSIZE) )
                         {
                             aOptions.pPattern = pPattern;
+                            const ScPatternAttr* pOldPattern = pPattern;
                             sal_uInt16 nHeight = (sal_uInt16)
                                     ( GetNeededSize( nRow, rCxt.getOutputDevice(), rCxt.getPPTX(), rCxt.getPPTY(),
-                                                        rCxt.getZoomX(), rCxt.getZoomY(), false, aOptions ) / rCxt.getPPTY() );
+                                                        rCxt.getZoomX(), rCxt.getZoomY(), false, aOptions,
+                                                        &pPattern) / rCxt.getPPTY() );
                             if (nHeight > pHeight[nRow-nStartRow])
                                 pHeight[nRow-nStartRow] = nHeight;
+                            // Pattern changed due to calculation? => sync.
+                            if (pPattern != pOldPattern)
+                            {
+                                pPattern = aIter.Resync( nRow, nStart, nEnd);
+                                nNextEnd = 0;
+                            }
                         }
                     }
                 }
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index e603337..b7e020f 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -451,7 +451,7 @@ long ScTable::GetNeededSize( SCCOL nCol, SCROW nRow,
     aOptions.bTotalSize  = bTotalSize;
 
     return aCol[nCol].GetNeededSize
-        ( nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, bWidth, aOptions );
+        ( nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, bWidth, aOptions, NULL );
 }
 
 bool ScTable::SetOptimalHeight(
@@ -1802,7 +1802,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
 
         Fraction aZoom(1,1);
         nPixel = aCol[rCol].GetNeededSize(
-            nRow, pDev, nPPTX, nPPTY, aZoom, aZoom, true, aOptions );
+            nRow, pDev, nPPTX, nPPTY, aZoom, aZoom, true, aOptions, NULL );
 
         aCol[rCol].SetTextWidth(nRow, static_cast<sal_uInt16>(nPixel));
     }
commit 467a0d624df1a62b8fa2b28d587c0b42ea3b3e04
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:52:54 2014 +1000

    vcl: move clipping functions from window.cxx into clipping.cxx
    
    Change-Id: I2a2c3d6283c962bba2994de04bbd869a79fc2eca

diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index 6c09c57..4659ee2 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -18,12 +18,16 @@
  */
 
 #include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
 
 #include <sal/types.h>
 
 #include <salobj.hxx>
 #include <window.h>
 
+#define IMPL_MAXSAVEBACKSIZE    (640*480)
+#define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
+
 void Window::InitClipRegion()
 {
     DBG_TESTSOLARMUTEX();
@@ -792,4 +796,175 @@ bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
     return false;
 }
 
+void Window::SaveBackground( const Point& rPos, const Size& rSize,
+                             const Point& rDestOff, VirtualDevice& rSaveDevice )
+{
+    if ( mpWindowImpl->mpPaintRegion )
+    {
+        Region      aClip( *mpWindowImpl->mpPaintRegion );
+        const Point aPixPos( LogicToPixel( rPos ) );
+
+        aClip.Move( -mnOutOffX, -mnOutOffY );
+        aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
+
+        if ( !aClip.IsEmpty() )
+        {
+            const Region    aOldClip( rSaveDevice.GetClipRegion() );
+            const Point     aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
+            const bool      bMap = rSaveDevice.IsMapModeEnabled();
+
+            // move clip region to have the same distance to DestOffset
+            aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
+
+            // set pixel clip region
+            rSaveDevice.EnableMapMode( false );
+            rSaveDevice.SetClipRegion( aClip );
+            rSaveDevice.EnableMapMode( bMap );
+            rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
+            rSaveDevice.SetClipRegion( aOldClip );
+        }
+    }
+    else
+        rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
+}
+
+void Window::ImplSaveOverlapBackground()
+{
+    DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
+
+    if ( !mpWindowImpl->mbFrame )
+    {
+        sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight;
+        if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
+        {
+            if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
+            {
+                Size aOutSize( mnOutWidth, mnOutHeight );
+                mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
+                if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
+                {
+                    mpWindowImpl->mpFrameWindow->ImplUpdateAll();
+
+                    if ( mpWindowImpl->mbInitWinClipRegion )
+                        ImplInitWinClipRegion();
+
+                    mpWindowImpl->mpOverlapData->mnSaveBackSize = nSaveBackSize;
+                    mpWindowImpl->mpFrameData->mnAllSaveBackSize += nSaveBackSize;
+                    Point aDevPt;
+
+                    OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
+                    pOutDev->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
+                                              aDevPt, aOutSize,
+                                              *(mpWindowImpl->mpOverlapData->mpSaveBackDev) );
+                    mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpFrameData->mpFirstBackWin;
+                    mpWindowImpl->mpFrameData->mpFirstBackWin = this;
+                }
+                else
+                {
+                    delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
+                    mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
+                }
+            }
+        }
+    }
+}
+
+bool Window::ImplRestoreOverlapBackground( Region& rInvRegion )
+{
+    if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
+    {
+        if ( mpWindowImpl->mbInitWinClipRegion )
+            ImplInitWinClipRegion();
+
+        if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
+        {
+            Point   aDevPt;
+            Point   aDestPt( mnOutOffX, mnOutOffY );
+            Size    aDevSize = mpWindowImpl->mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
+
+            OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
+
+            if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
+            {
+                mpWindowImpl->mpOverlapData->mpSaveBackRgn->Intersect( mpWindowImpl->maWinClipRegion );
+                rInvRegion = mpWindowImpl->maWinClipRegion;
+                rInvRegion.Exclude( *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
+                pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
+                                           *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
+                                           *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
+            }
+            else
+            {
+                pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
+                                           *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
+                                           mpWindowImpl->maWinClipRegion );
+            }
+            ImplDeleteOverlapBackground();
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+void Window::ImplDeleteOverlapBackground()
+{
+    if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
+    {
+        mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
+        delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
+        mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
+        if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
+        {
+            delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
+            mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
+        }
+
+        // remove window from the list
+        if ( mpWindowImpl->mpFrameData->mpFirstBackWin == this )
+            mpWindowImpl->mpFrameData->mpFirstBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
+        else
+        {
+            Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
+            while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
+                pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
+            pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
+        }
+        mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
+    }
+}
+
+void Window::ImplInvalidateAllOverlapBackgrounds()
+{
+    Window* pWindow = mpWindowImpl->mpFrameData->mpFirstBackWin;
+    while ( pWindow )
+    {
+        // remember next window here already, as this window could
+        // be removed within the next if clause from the list
+        Window* pNext = pWindow->mpWindowImpl->mpOverlapData->mpNextBackWin;
+
+        if ( ImplIsWindowInFront( pWindow ) )
+        {
+            Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
+                              Size( mnOutWidth, mnOutHeight ) );
+            Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+                              Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+            aRect1.Intersection( aRect2 );
+            if ( !aRect1.IsEmpty() )
+            {
+                if ( !pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn )
+                    pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
+                pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
+                if ( pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->IsEmpty() )
+                    pWindow->ImplDeleteOverlapBackground();
+            }
+
+        }
+
+        pWindow = pNext;
+    }
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index b678321..6a9be38 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -52,6 +52,14 @@ struct ImplCalcToTopData
     Region*             mpInvalidateRegion;
 };
 
+Window* Window::ImplGetTopmostFrameWindow()
+{
+    Window *pTopmostParent = this;
+    while( pTopmostParent->ImplGetParent() )
+        pTopmostParent = pTopmostParent->ImplGetParent();
+    return pTopmostParent->mpWindowImpl->mpFrameWindow;
+}
+
 void Window::ImplInsertWindow( Window* pParent )
 {
     mpWindowImpl->mpParent            = pParent;
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 3931953..24ed6fa 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -47,147 +47,6 @@
 
 using namespace com::sun::star;
 
-#define IMPL_MAXSAVEBACKSIZE    (640*480)
-#define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
-
-void Window::ImplSaveOverlapBackground()
-{
-    DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
-
-    if ( !mpWindowImpl->mbFrame )
-    {
-        sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight;
-        if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
-        {
-            if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
-            {
-                Size aOutSize( mnOutWidth, mnOutHeight );
-                mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
-                if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
-                {
-                    mpWindowImpl->mpFrameWindow->ImplUpdateAll();
-
-                    if ( mpWindowImpl->mbInitWinClipRegion )
-                        ImplInitWinClipRegion();
-
-                    mpWindowImpl->mpOverlapData->mnSaveBackSize = nSaveBackSize;
-                    mpWindowImpl->mpFrameData->mnAllSaveBackSize += nSaveBackSize;
-                    Point aDevPt;
-
-                    OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
-                    pOutDev->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
-                                              aDevPt, aOutSize,
-                                              *(mpWindowImpl->mpOverlapData->mpSaveBackDev) );
-                    mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpFrameData->mpFirstBackWin;
-                    mpWindowImpl->mpFrameData->mpFirstBackWin = this;
-                }
-                else
-                {
-                    delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
-                    mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
-                }
-            }
-        }
-    }
-}
-
-bool Window::ImplRestoreOverlapBackground( Region& rInvRegion )
-{
-    if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
-    {
-        if ( mpWindowImpl->mbInitWinClipRegion )
-            ImplInitWinClipRegion();
-
-        if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
-        {
-            Point   aDevPt;
-            Point   aDestPt( mnOutOffX, mnOutOffY );
-            Size    aDevSize = mpWindowImpl->mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
-
-            OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
-
-            if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
-            {
-                mpWindowImpl->mpOverlapData->mpSaveBackRgn->Intersect( mpWindowImpl->maWinClipRegion );
-                rInvRegion = mpWindowImpl->maWinClipRegion;
-                rInvRegion.Exclude( *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
-                pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
-                                           *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
-                                           *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
-            }
-            else
-            {
-                pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
-                                           *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
-                                           mpWindowImpl->maWinClipRegion );
-            }
-            ImplDeleteOverlapBackground();
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-void Window::ImplDeleteOverlapBackground()
-{
-    if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
-    {
-        mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
-        delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
-        mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
-        if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
-        {
-            delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
-            mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
-        }
-
-        // remove window from the list
-        if ( mpWindowImpl->mpFrameData->mpFirstBackWin == this )
-            mpWindowImpl->mpFrameData->mpFirstBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
-        else
-        {
-            Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
-            while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
-                pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
-            pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
-        }
-        mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
-    }
-}
-
-void Window::ImplInvalidateAllOverlapBackgrounds()
-{
-    Window* pWindow = mpWindowImpl->mpFrameData->mpFirstBackWin;
-    while ( pWindow )
-    {
-        // remember next window here already, as this window could
-        // be removed within the next if clause from the list
-        Window* pNext = pWindow->mpWindowImpl->mpOverlapData->mpNextBackWin;
-
-        if ( ImplIsWindowInFront( pWindow ) )
-        {
-            Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
-                              Size( mnOutWidth, mnOutHeight ) );
-            Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
-                              Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
-            aRect1.Intersection( aRect2 );
-            if ( !aRect1.IsEmpty() )
-            {
-                if ( !pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn )
-                    pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
-                pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
-                if ( pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->IsEmpty() )
-                    pWindow->ImplDeleteOverlapBackground();
-            }
-
-        }
-
-        pWindow = pNext;
-    }
-}
-
 void Window::ShowFocus( const Rectangle& rRect )
 {
     if( mpWindowImpl->mbInShowFocus )
@@ -611,38 +470,6 @@ void Window::EndAutoScroll()
     }
 }
 
-void Window::SaveBackground( const Point& rPos, const Size& rSize,
-                             const Point& rDestOff, VirtualDevice& rSaveDevice )
-{
-    if ( mpWindowImpl->mpPaintRegion )
-    {
-        Region      aClip( *mpWindowImpl->mpPaintRegion );
-        const Point aPixPos( LogicToPixel( rPos ) );
-
-        aClip.Move( -mnOutOffX, -mnOutOffY );
-        aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
-
-        if ( !aClip.IsEmpty() )
-        {
-            const Region    aOldClip( rSaveDevice.GetClipRegion() );
-            const Point     aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
-            const bool      bMap = rSaveDevice.IsMapModeEnabled();
-
-            // move clip region to have the same distance to DestOffset
-            aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
-
-            // set pixel clip region
-            rSaveDevice.EnableMapMode( false );
-            rSaveDevice.SetClipRegion( aClip );
-            rSaveDevice.EnableMapMode( bMap );
-            rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
-            rSaveDevice.SetClipRegion( aOldClip );
-        }
-    }
-    else
-        rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
-}
-
 sal_uIntPtr Window::SaveFocus()
 {
     ImplSVData* pSVData = ImplGetSVData();
@@ -1112,14 +939,6 @@ void Window::EnableDocking( bool bEnable )
     return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
 }
 
-Window* Window::ImplGetTopmostFrameWindow()
-{
-    Window *pTopmostParent = this;
-    while( pTopmostParent->ImplGetParent() )
-        pTopmostParent = pTopmostParent->ImplGetParent();
-    return pTopmostParent->mpWindowImpl->mpFrameWindow;
-}
-
 void Window::SetHelpId( const OString& rHelpId )
 {
     mpWindowImpl->maHelpId = rHelpId;
commit 7b545001a10042c03ddde09ac9e0e6c3cdf6f8ca
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:49:56 2014 +1000

    vcl: move functionality from window2.cxx
    
    Change-Id: I68d1c7bb32df9024ea57a07d7d3b051efc08b2ed

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 7fa60e3..155346f 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -393,6 +393,11 @@ private:
     void            AttachToWindow( const Window* );
 };
 
+struct ImplFocusDelData : public ImplDelData
+{
+    Window*         mpFocusWin;
+};
+
 struct ImplSVEvent
 {
     void*               mpData;
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index f7afeb1..6c09c57 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -706,4 +706,90 @@ void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegio
     }
 }
 
+bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
+{
+    // check for overlapping window
+    pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
+    const Window* pTempWindow = pTestWindow;
+    const Window* pThisWindow = ImplGetFirstOverlapWindow();
+    if ( pTempWindow == pThisWindow )
+        return false;
+    do
+    {
+        if ( pTempWindow == pThisWindow )
+            return true;
+        if ( pTempWindow->mpWindowImpl->mbFrame )
+            break;
+        pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
+    }
+    while ( pTempWindow );
+    pTempWindow = pThisWindow;
+    do
+    {
+        if ( pTempWindow == pTestWindow )
+            return false;
+        if ( pTempWindow->mpWindowImpl->mbFrame )
+            break;
+        pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
+    }
+    while ( pTempWindow );
+
+    // move window to same level
+    if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow )
+    {
+        sal_uInt16 nThisLevel = 0;
+        sal_uInt16 nTestLevel = 0;
+        pTempWindow = pThisWindow;
+        do
+        {
+            nThisLevel++;
+            pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
+        }
+        while ( !pTempWindow->mpWindowImpl->mbFrame );
+        pTempWindow = pTestWindow;
+        do
+        {
+            nTestLevel++;
+            pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
+        }
+        while ( !pTempWindow->mpWindowImpl->mbFrame );
+
+        if ( nThisLevel < nTestLevel )
+        {
+            do
+            {
+                if ( pTestWindow->mpWindowImpl->mpOverlapWindow == pThisWindow->mpWindowImpl->mpOverlapWindow )
+                    break;
+                if ( pTestWindow->mpWindowImpl->mbFrame )
+                    break;
+                pTestWindow = pTestWindow->mpWindowImpl->mpOverlapWindow;
+            }
+            while ( pTestWindow );
+        }
+        else
+        {
+            do
+            {
+                if ( pThisWindow->mpWindowImpl->mpOverlapWindow == pTempWindow->mpWindowImpl->mpOverlapWindow )
+                    break;
+                if ( pThisWindow->mpWindowImpl->mbFrame )
+                    break;
+                pThisWindow = pThisWindow->mpWindowImpl->mpOverlapWindow;
+            }
+            while ( pThisWindow );
+        }
+    }
+
+    // if TestWindow is before ThisWindow, it is in front
+    pTempWindow = pTestWindow;
+    while ( pTempWindow )
+    {
+        if ( pTempWindow == pThisWindow )
+            return true;
+        pTempWindow = pTempWindow->mpWindowImpl->mpNext;
+    }
+
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 8c9b44f..3931953 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -50,97 +50,6 @@ using namespace com::sun::star;
 #define IMPL_MAXSAVEBACKSIZE    (640*480)
 #define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
 
-struct ImplFocusDelData : public ImplDelData
-{
-    Window*         mpFocusWin;
-};
-
-bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
-{
-    // check for overlapping window
-    pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
-    const Window* pTempWindow = pTestWindow;
-    const Window* pThisWindow = ImplGetFirstOverlapWindow();
-    if ( pTempWindow == pThisWindow )
-        return false;
-    do
-    {
-        if ( pTempWindow == pThisWindow )
-            return true;
-        if ( pTempWindow->mpWindowImpl->mbFrame )
-            break;
-        pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
-    }
-    while ( pTempWindow );
-    pTempWindow = pThisWindow;
-    do
-    {
-        if ( pTempWindow == pTestWindow )
-            return false;
-        if ( pTempWindow->mpWindowImpl->mbFrame )
-            break;
-        pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
-    }
-    while ( pTempWindow );
-
-    // move window to same level
-    if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow )
-    {
-        sal_uInt16 nThisLevel = 0;
-        sal_uInt16 nTestLevel = 0;
-        pTempWindow = pThisWindow;
-        do
-        {
-            nThisLevel++;
-            pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
-        }
-        while ( !pTempWindow->mpWindowImpl->mbFrame );
-        pTempWindow = pTestWindow;
-        do
-        {
-            nTestLevel++;
-            pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
-        }
-        while ( !pTempWindow->mpWindowImpl->mbFrame );
-
-        if ( nThisLevel < nTestLevel )
-        {
-            do
-            {
-                if ( pTestWindow->mpWindowImpl->mpOverlapWindow == pThisWindow->mpWindowImpl->mpOverlapWindow )
-                    break;
-                if ( pTestWindow->mpWindowImpl->mbFrame )
-                    break;
-                pTestWindow = pTestWindow->mpWindowImpl->mpOverlapWindow;
-            }
-            while ( pTestWindow );
-        }
-        else
-        {
-            do
-            {
-                if ( pThisWindow->mpWindowImpl->mpOverlapWindow == pTempWindow->mpWindowImpl->mpOverlapWindow )
-                    break;
-                if ( pThisWindow->mpWindowImpl->mbFrame )
-                    break;
-                pThisWindow = pThisWindow->mpWindowImpl->mpOverlapWindow;
-            }
-            while ( pThisWindow );
-        }
-    }
-
-    // if TestWindow is before ThisWindow, it is in front
-    pTempWindow = pTestWindow;
-    while ( pTempWindow )
-    {
-        if ( pTempWindow == pThisWindow )
-            return true;
-        pTempWindow = pTempWindow->mpWindowImpl->mpNext;
-    }
-
-    return false;
-}
-
 void Window::ImplSaveOverlapBackground()
 {
     DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
commit fee65f9d20da80cfbc7dc516c8a7e3f4560ce23a
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:22:06 2014 +1000

    vcl: rearrange function in window.cxx
    
    Change-Id: Icb7f692cdf03a77573379257b34400f38def71ec

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 659b9e2..f16e6bd 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1182,6 +1182,31 @@ void Window::ImplInitWindowData( WindowType nType )
     mbEnableRTL         = Application::GetSettings().GetLayoutRTL();         // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
 }
 
+ImplWinData* Window::ImplGetWinData() const
+{
+    if ( !mpWindowImpl->mpWinData )
+    {
+        static const char* pNoNWF = getenv( "SAL_NO_NWF" );
+
+        ((Window*)this)->mpWindowImpl->mpWinData = new ImplWinData;
+        mpWindowImpl->mpWinData->mpExtOldText     = NULL;
+        mpWindowImpl->mpWinData->mpExtOldAttrAry  = NULL;
+        mpWindowImpl->mpWinData->mpCursorRect     = NULL;
+        mpWindowImpl->mpWinData->mnCursorExtWidth = 0;
+        mpWindowImpl->mpWinData->mpCompositionCharRects = NULL;
+        mpWindowImpl->mpWinData->mnCompositionCharRects = 0;
+        mpWindowImpl->mpWinData->mpFocusRect      = NULL;
+        mpWindowImpl->mpWinData->mpTrackRect      = NULL;
+        mpWindowImpl->mpWinData->mnTrackFlags     = 0;
+        mpWindowImpl->mpWinData->mnIsTopWindow  = (sal_uInt16) ~0;  // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
+        mpWindowImpl->mpWinData->mbMouseOver      = false;
+        mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? false : true; // true: try to draw this control with native theme API
+    }
+
+    return mpWindowImpl->mpWinData;
+}
+
+
 void Window::CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags )
 {
     if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
@@ -1263,30 +1288,6 @@ bool ImplDoTiledRendering()
 #endif
 }
 
-ImplWinData* Window::ImplGetWinData() const
-{
-    if ( !mpWindowImpl->mpWinData )
-    {
-        static const char* pNoNWF = getenv( "SAL_NO_NWF" );
-
-        ((Window*)this)->mpWindowImpl->mpWinData = new ImplWinData;
-        mpWindowImpl->mpWinData->mpExtOldText     = NULL;
-        mpWindowImpl->mpWinData->mpExtOldAttrAry  = NULL;
-        mpWindowImpl->mpWinData->mpCursorRect     = NULL;
-        mpWindowImpl->mpWinData->mnCursorExtWidth = 0;
-        mpWindowImpl->mpWinData->mpCompositionCharRects = NULL;
-        mpWindowImpl->mpWinData->mnCompositionCharRects = 0;
-        mpWindowImpl->mpWinData->mpFocusRect      = NULL;
-        mpWindowImpl->mpWinData->mpTrackRect      = NULL;
-        mpWindowImpl->mpWinData->mnTrackFlags     = 0;
-        mpWindowImpl->mpWinData->mnIsTopWindow  = (sal_uInt16) ~0;  // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
-        mpWindowImpl->mpWinData->mbMouseOver      = false;
-        mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? false : true; // true: try to draw this control with native theme API
-   }
-
-    return mpWindowImpl->mpWinData;
-}
-
 SalGraphics* Window::ImplGetFrameGraphics() const
 {
     if ( mpWindowImpl->mpFrameWindow->mpGraphics )
commit d333ca56ef9e5e90a25afe170ddd09d7b902dae6
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:08:25 2014 +1000

    vcl: "non-pro version" actually means debug builds
    
    Change-Id: I814869869bbc16a8bae94ef9c5deaeb97c13f03e

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 58bb5f7..659b9e2 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -244,7 +244,7 @@ Window::~Window()
         pSVData->maWinData.mpDefDialogParent = NULL;
 
 #if OSL_DEBUG_LEVEL > 0
-    if ( true ) // always perform these tests in non-pro versions
+    if ( true ) // always perform these tests in debug builds
     {
         OStringBuffer aErrorStr;
         bool        bError = false;
@@ -270,7 +270,7 @@ Window::~Window()
                 aTempStr.append(") with live SystemWindows destroyed: ");
                 aTempStr.append(aErrorStr.toString());
                 OSL_FAIL(aTempStr.getStr());
-                // abort in non-pro version, this must be fixed!
+                // abort in debug builds, must be fixed!
                 GetpApp()->Abort(OStringToOUString(
                                      aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
             }
@@ -294,7 +294,7 @@ Window::~Window()
             aTempStr.append(") with live SystemWindows destroyed: ");
             aTempStr.append(aErrorStr.toString());
             OSL_FAIL( aTempStr.getStr() );
-            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in non-pro version, this must be fixed!
+            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!
         }
 
         if ( mpWindowImpl->mpFirstChild )
@@ -309,7 +309,7 @@ Window::~Window()
                 pTempWin = pTempWin->mpWindowImpl->mpNext;
             }
             OSL_FAIL( aTempStr.getStr() );
-            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in non-pro version, this must be fixed!
+            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!
         }
 
         if ( mpWindowImpl->mpFirstOverlap )
@@ -324,7 +324,7 @@ Window::~Window()
                 pTempWin = pTempWin->mpWindowImpl->mpNext;
             }
             OSL_FAIL( aTempStr.getStr() );
-            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in non-pro version, this must be fixed!
+            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!
         }
 
         Window* pMyParent = this;
@@ -342,7 +342,7 @@ Window::~Window()
             aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
             aTempStr.append(") still in TaskPanelList!");
             OSL_FAIL( aTempStr.getStr() );
-            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in non-pro version, this must be fixed!
+            GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));   // abort in debug builds, this must be fixed!
         }
     }
 #endif
@@ -411,7 +411,7 @@ Window::~Window()
             RTL_TEXTENCODING_UTF8)).
                 append(") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !");
         OSL_FAIL( aTempStr.getStr() );
-        GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ));   // abort in non-pro version, this must be fixed!
+        GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ));   // abort in debug build version, this must be fixed!
 #endif
     }
 
commit 495cbf4f7d726d5e839a2be146b866a613724cca
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:06:12 2014 +1000

    vcl: cleanup window.cxx namespace aliases
    
    Change-Id: I3b8782ed7bbd782dbca52cd4bec46582a9b35271

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 4d46db8..58bb5f7 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -77,8 +77,6 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::datatransfer::clipboard;
 using namespace ::com::sun::star::datatransfer::dnd;
-using namespace ::com::sun::star;
-using namespace com::sun;
 
 using ::com::sun::star::awt::XTopWindow;
 
@@ -141,11 +139,10 @@ Window::~Window()
 
     // Dispose of the canvas implementation (which, currently, has an
     // own wrapper window as a child to this one.
-    uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+    Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
     if( xCanvas.is() )
     {
-        uno::Reference < lang::XComponent > xCanvasComponent( xCanvas,
-                                                              uno::UNO_QUERY );
+        Reference < XComponent > xCanvasComponent( xCanvas, UNO_QUERY );
         if( xCanvasComponent.is() )
             xCanvasComponent->dispose();
     }
@@ -173,7 +170,7 @@ Window::~Window()
     }
 
     // shutdown drag and drop
-    ::com::sun::star::uno::Reference < ::com::sun::star::lang::XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, ::com::sun::star::uno::UNO_QUERY );
+    Reference < XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY );
 
     if( xDnDComponent.is() )
         xDnDComponent->dispose();
@@ -185,12 +182,12 @@ Window::~Window()
             // deregister drop target listener
             if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
             {
-                uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
-                    uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
+                Reference< XDragGestureRecognizer > xDragGestureRecognizer =
+                    Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
                 if( xDragGestureRecognizer.is() )
                 {
                     xDragGestureRecognizer->removeDragGestureListener(
-                        uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
+                        Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
                 }
 
                 mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
@@ -198,7 +195,7 @@ Window::~Window()
             }
 
             // shutdown drag and drop for this frame window
-            uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
+            Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
 
             // DNDEventDispatcher does not hold a reference of the DropTarget,
             // so it's ok if it does not support XComponent
@@ -220,7 +217,7 @@ Window::~Window()
     // But accessibility implementations from applications need this dispose.
     if ( mpWindowImpl->mxAccessible.is() )
     {
-        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xC( mpWindowImpl->mxAccessible, ::com::sun::star::uno::UNO_QUERY );
+        Reference< XComponent> xC( mpWindowImpl->mxAccessible, UNO_QUERY );
         if ( xC.is() )
             xC->dispose();
     }
@@ -967,9 +964,9 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
         if ( !pFrame )
         {
             // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
-            throw ::com::sun::star::uno::RuntimeException(
+            throw RuntimeException(
                 OUString( "Could not create system window!"  ),
-                ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
+                Reference< XInterface >() );
         }
 
         pFrame->SetCallback( this, ImplWindowFrameProc );
@@ -3235,7 +3232,7 @@ const OUString& Window::GetHelpText() const
     return mpWindowImpl->maHelpText;
 }
 
-void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow  )
+void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow  )
 {
     // be safe against re-entrance: first clear the old ref, then assign the new one
     mpWindowImpl->mxWindowPeer.clear();
@@ -3244,7 +3241,7 @@ void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::
     mpWindowImpl->mpVCLXWindow = pVCLXWindow;
 }
 
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( sal_Bool bCreate )
+Reference< css::awt::XWindowPeer > Window::GetComponentInterface( sal_Bool bCreate )
 {
     if ( !mpWindowImpl->mxWindowPeer.is() && bCreate )
     {
@@ -3255,7 +3252,7 @@ void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::
     return mpWindowImpl->mxWindowPeer;
 }
 
-void Window::SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace )
+void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > xIFace )
 {
     UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
     DBG_ASSERT( pWrapper, "SetComponentInterface: No Wrapper!" );
@@ -3300,7 +3297,7 @@ void Window::ImplCallActivateListeners( Window *pOld )
     }
 }
 
-uno::Reference< XClipboard > Window::GetClipboard()
+Reference< XClipboard > Window::GetClipboard()
 {
 
     if( mpWindowImpl->mpFrameData )
@@ -3313,7 +3310,7 @@ uno::Reference< XClipboard > Window::GetClipboard()
                     = css::datatransfer::clipboard::SystemClipboard::create(
                         comphelper::getProcessComponentContext());
             }
-            catch (css::uno::DeploymentException & e)
+            catch (DeploymentException & e)
             {
                 SAL_WARN(
                     "vcl.window",
@@ -3327,7 +3324,7 @@ uno::Reference< XClipboard > Window::GetClipboard()
     return static_cast < XClipboard * > (0);
 }
 
-uno::Reference< XClipboard > Window::GetPrimarySelection()
+Reference< XClipboard > Window::GetPrimarySelection()
 {
 
     if( mpWindowImpl->mpFrameData )
@@ -3336,27 +3333,27 @@ uno::Reference< XClipboard > Window::GetPrimarySelection()
         {
             try
             {
-                uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
+                Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
 
 #if HAVE_FEATURE_X11
                 // A hack, making the primary selection available as an instance
                 // of the SystemClipboard service on X11:
-                css::uno::Sequence<css::uno::Any> args(1);
+                Sequence< Any > args(1);
                 args[0] <<= OUString("PRIMARY");
                 mpWindowImpl->mpFrameData->mxSelection.set(
                     (xContext->getServiceManager()->
                      createInstanceWithArgumentsAndContext(
                          "com.sun.star.datatransfer.clipboard.SystemClipboard",
                          args, xContext)),
-                    css::uno::UNO_QUERY_THROW);
+                    UNO_QUERY_THROW);
 #else
-                static uno::Reference< XClipboard > s_xSelection(
+                static Reference< XClipboard > s_xSelection(
                     xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.datatransfer.clipboard.GenericClipboard", xContext ), UNO_QUERY );
 
                 mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
 #endif
             }
-            catch (css::uno::RuntimeException & e)
+            catch (RuntimeException & e)
             {
                 SAL_WARN(
                     "vcl.window",
@@ -3701,12 +3698,12 @@ bool Window::IsNativeWidgetEnabled() const
     return ImplGetWinData()->mbEnableNativeWidget;
 }
 
-uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize,
+Reference< css::rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize,
                                                        bool        bFullscreen,
                                                        bool        bSpriteCanvas ) const
 {
     // try to retrieve hard reference from weak member
-    uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+    Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
 
     // canvas still valid? Then we're done.
     if( xCanvas.is() )
@@ -3737,24 +3734,24 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr
     }
 
     if( bFullscreen )
-        aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( 0, 0,
-                                                               rFullscreenSize.Width(),
-                                                               rFullscreenSize.Height() ) );
+        aArg[ 2 ] = makeAny( css::awt::Rectangle( 0, 0,
+                                    rFullscreenSize.Width(),
+                                    rFullscreenSize.Height() ) );
     else
-        aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
+        aArg[ 2 ] = makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
 
     aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? true : false );
-    aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >(
+    aArg[ 4 ] = makeAny( Reference< css::awt::XWindow >(
                              const_cast<Window*>(this)->GetComponentInterface(),
-                             uno::UNO_QUERY ));
+                             UNO_QUERY ));
 
-    uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
+    Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
 
     // Create canvas instance with window handle
 
-    static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiComponentFactory> xStaticCanvasFactory(
-        rendering::CanvasFactory::create( xContext ) );
-    uno::Reference<lang::XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get());
+    static ::vcl::DeleteUnoReferenceOnDeinit<XMultiComponentFactory> xStaticCanvasFactory(
+        css::rendering::CanvasFactory::create( xContext ) );
+    Reference<XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get());
 
     if(xCanvasFactory.is())
     {
@@ -3797,15 +3794,15 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr
     return xCanvas;
 }
 
-uno::Reference< rendering::XCanvas > Window::GetCanvas() const
+Reference< css::rendering::XCanvas > Window::GetCanvas() const
 {
     return ImplGetCanvas( Size(), false, false );
 }
 
-uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
+Reference< css::rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
 {
-    uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas(
-        ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY );
+    Reference< css::rendering::XSpriteCanvas > xSpriteCanvas(
+        ImplGetCanvas( Size(), false, true ), UNO_QUERY );
     return xSpriteCanvas;
 }
 
@@ -3872,13 +3869,13 @@ const SystemEnvData* Window::GetSystemData() const
     return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : NULL;
 }
 
-css::uno::Any Window::GetSystemDataAny() const
+Any Window::GetSystemDataAny() const
 {
-    css::uno::Any aRet;
+    Any aRet;
     const SystemEnvData* pSysData = GetSystemData();
     if( pSysData )
     {
-        css::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize );
+        Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize );
         aRet <<= aSeq;
     }
     return aRet;
commit 0c6cd530de13f80795881f61064f1bf1dcc4ea81
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue May 27 00:03:10 2014 +1000

    vcl: move GetSystemData() & GetSystemDataAny() back to window.cxx
    
    Change-Id: I46736950563776bb4f5fefd71789010541e99e70

diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index 5155efc..b678321 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -1174,22 +1174,4 @@ void Window::ImplSetFrameParent( const Window* pParent )
     }
 }
 
-const SystemEnvData* Window::GetSystemData() const
-{
-
-    return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : NULL;
-}
-
-::com::sun::star::uno::Any Window::GetSystemDataAny() const
-{
-    ::com::sun::star::uno::Any aRet;
-    const SystemEnvData* pSysData = GetSystemData();
-    if( pSysData )
-    {
-        ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize );
-        aRet <<= aSeq;
-    }
-    return aRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 733c4aa..4d46db8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3866,4 +3866,22 @@ void Window::DrawGradientWallpaper( long nX, long nY,
     mpMetaFile = pOldMetaFile;
 }
 
+const SystemEnvData* Window::GetSystemData() const
+{
+

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list