Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1779

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/79/1779/1

copy styles from cond format between different docs, fdo#59159

Change-Id: I5472ab648b248d925f1f07cd4194c1201230ff20
---
M sc/source/core/data/table2.cxx
1 file changed, 26 insertions(+), 0 deletions(-)



diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 073f726..07ab79e 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -658,6 +658,7 @@
 {
     ScRange aOldRange( nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, 
pTable->nTab);
     ScRange aNewRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
+    bool bSameDoc = pDocument == pTable->pDocument;
 
     for(ScConditionalFormatList::const_iterator itr = pTable->mpCondFormatList->begin(),
             itrEnd = pTable->mpCondFormatList->end(); itr != itrEnd; ++itr)
@@ -681,6 +682,29 @@
         }
         pNewFormat->SetKey(nMax + 1);
         mpCondFormatList->InsertNew(pNewFormat);
+
+        if(!bSameDoc)
+        {
+            for(size_t i = 0, n = pNewFormat->size();
+                    i < n; ++i)
+            {
+                OUString aStyleName;
+                const ScFormatEntry* pEntry = pNewFormat->GetEntry(i);
+                if(pEntry->GetType() == condformat::CONDITION)
+                    aStyleName = static_cast<const ScCondFormatEntry*>(pEntry)->GetStyle();
+                else if(pEntry->GetType() == condformat::DATE)
+                    aStyleName = static_cast<const ScCondDateFormatEntry*>(pEntry)->GetStyleName();
+
+                if(!aStyleName.isEmpty())
+                {
+                    if(pDocument->GetStyleSheetPool()->Find(aStyleName, SFX_STYLE_FAMILY_PARA))
+                        continue;
+
+                    pDocument->GetStyleSheetPool()->CopyStyleFrom(
+                            pTable->pDocument->GetStyleSheetPool(), aStyleName, 
SFX_STYLE_FAMILY_PARA );
+                }
+            }
+        }
 
         pDocument->AddCondFormatData( pNewFormat->GetRange(), nTab, pNewFormat->GetKey() );
     }
@@ -967,7 +991,9 @@
     }
 
     if(pDestTab->pDocument->IsUndo() && (nFlags & IDF_ATTRIB))
+    {
         pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->pDocument, 
*mpCondFormatList));
+    }
 
     if (pDBDataNoName)
     {

-- 
To view, visit https://gerrit.libreoffice.org/1779
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5472ab648b248d925f1f07cd4194c1201230ff20
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Markus Mohrhard <markus.mohrhard@googlemail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.