summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icon-themes/galaxy/sw/imglst/sf06.pngbin0 -> 539 bytes
-rw-r--r--include/sfx2/sfxsids.hrc1
-rw-r--r--rsc/source/parser/rscicpx.cxx1
-rw-r--r--sfx2/sdi/sfx.sdi17
-rw-r--r--sfx2/source/dialog/templdlg.cxx5
-rw-r--r--sfx2/source/dialog/tplcitem.cxx3
-rw-r--r--sfx2/source/inc/templdgi.hxx4
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/inc/fesh.hxx1
-rw-r--r--sw/inc/tblafmt.hxx12
-rw-r--r--sw/sdi/_basesh.sdi5
-rw-r--r--sw/sdi/_docsh.sdi6
-rw-r--r--sw/sdi/annotsh.sdi5
-rw-r--r--sw/source/core/doc/poolfmt.cxx16
-rw-r--r--sw/source/core/doc/tblafmt.cxx6
-rw-r--r--sw/source/core/frmedt/fetab.cxx15
-rw-r--r--sw/source/ui/app/app.src16
-rw-r--r--sw/source/uibase/app/docst.cxx17
-rw-r--r--sw/source/uibase/app/docstyle.cxx44
19 files changed, 169 insertions, 7 deletions
diff --git a/icon-themes/galaxy/sw/imglst/sf06.png b/icon-themes/galaxy/sw/imglst/sf06.png
new file mode 100644
index 000000000000..ce7e5ac5ac3e
--- /dev/null
+++ b/icon-themes/galaxy/sw/imglst/sf06.png
Binary files differ
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 09462483414f..b39390a010b7 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -313,6 +313,7 @@
#define SID_STYLE_FAMILY3 (SID_STYLE_FAMILY_START + 2)
#define SID_STYLE_FAMILY4 (SID_STYLE_FAMILY_START + 3)
#define SID_STYLE_FAMILY5 (SID_STYLE_FAMILY_START + 4)
+#define SID_STYLE_FAMILY6 (SID_STYLE_FAMILY_START + 5)
#define SID_STYLE_NEW (SID_SFX_START + 549)
#define SID_STYLE_EDIT (SID_SFX_START + 550)
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index a66f6a0f4541..584b6815dfba 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -1151,6 +1151,7 @@ RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper,
SETCONST( pSfxStyleFamily, "SfxStyleFamily::Frame",SfxStyleFamily::Frame);
SETCONST( pSfxStyleFamily, "SfxStyleFamily::Page", SfxStyleFamily::Page );
SETCONST( pSfxStyleFamily, "SfxStyleFamily::Pseudo", SfxStyleFamily::Pseudo );
+ SETCONST( pSfxStyleFamily, "SfxStyleFamily::Table", SfxStyleFamily::Table );
aBaseLst.push_back( pSfxStyleFamily );
nId = aNmTb.Put( "StyleFamily", VARNAME );
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 7e396afc617c..f5e366abcdb1 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4459,6 +4459,23 @@ SfxTemplateItem ListStyle SID_STYLE_FAMILY5
GroupId = GID_DOCUMENT;
]
+SfxTemplateItem TableStyle SID_STYLE_FAMILY6
+
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
SfxBoolItem TipsDialog SID_TIPWINDOW
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index e185487513a7..f0a5369abdf6 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -754,6 +754,8 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
nSlot = SID_STYLE_FAMILY4; break;
case SfxStyleFamily::Pseudo:
nSlot = SID_STYLE_FAMILY5; break;
+ case SfxStyleFamily::Table:
+ nSlot = SID_STYLE_FAMILY6; break;
default: OSL_FAIL("unknown StyleFamily"); break;
}
pBoundItems[i] =
@@ -896,6 +898,7 @@ namespace SfxTemplate
case SfxStyleFamily::Frame: return 3;
case SfxStyleFamily::Page: return 4;
case SfxStyleFamily::Pseudo: return 5;
+ case SfxStyleFamily::Table: return 6;
default: return 0;
}
}
@@ -909,6 +912,7 @@ namespace SfxTemplate
case 3: return SfxStyleFamily::Frame;
case 4: return SfxStyleFamily::Page;
case 5: return SfxStyleFamily::Pseudo;
+ case 6: return SfxStyleFamily::Table;
default: return SfxStyleFamily::All;
}
}
@@ -2291,6 +2295,7 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil
case SfxStyleFamily::Frame: sHelpId = ".uno:FrameStyle"; break;
case SfxStyleFamily::Page: sHelpId = ".uno:PageStyle"; break;
case SfxStyleFamily::Pseudo: sHelpId = ".uno:ListStyle"; break;
+ case SfxStyleFamily::Table: sHelpId = ".uno:TableStyle"; break;
default: OSL_FAIL("unknown StyleFamily"); break;
}
m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx
index 714a2aaaa0d2..e0916ba64450 100644
--- a/sfx2/source/dialog/tplcitem.cxx
+++ b/sfx2/source/dialog/tplcitem.cxx
@@ -63,6 +63,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta
case SID_STYLE_FAMILY3:
case SID_STYLE_FAMILY4:
case SID_STYLE_FAMILY5:
+ case SID_STYLE_FAMILY6:
{
bool bAvailable = SfxItemState::DEFAULT == eState;
if ( !bAvailable )
@@ -87,6 +88,8 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta
nFamily = 4; break;
case SID_STYLE_FAMILY5:
nFamily = 5; break;
+ case SID_STYLE_FAMILY6:
+ nFamily = 6; break;
default: OSL_FAIL("unknown StyleFamily"); break;
}
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 385a40a5a1d1..0938658da8b7 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -162,8 +162,8 @@ private:
DeletionWatcher* impl_setDeletionWatcher(DeletionWatcher* pNewWatcher);
protected:
-#define MAX_FAMILIES 5
-#define COUNT_BOUND_FUNC 13
+#define MAX_FAMILIES 6
+#define COUNT_BOUND_FUNC 14
friend class DropListBox_Impl;
friend class SfxTemplateControllerItem;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index dc96eb0af54d..755c59833cc0 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -890,6 +890,8 @@ public:
// Query if style (paragraph- / character- / frame- / page-) is used.
bool IsUsed( const SwModify& ) const;
+ /// Query if table style is used.
+ bool IsUsed( const SwTableAutoFormat& ) const;
static bool IsUsed( const SwNumRule& );
// Set name of newly loaded document template.
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 0e311d08a255..a1fefd8d1495 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -725,6 +725,7 @@ public:
bool IsAdjustCellWidthAllowed( bool bBalance = false ) const;
/// Set table style of the current table.
+ bool SetTableStyle(const OUString& rStyleName);
bool SetTableStyle(const SwTableAutoFormat& rNew);
/// Update the direct formatting according to the current table style.
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 06aa12b6adcc..92bd534cdc28 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -266,6 +266,8 @@ class SW_DLLPUBLIC SwTableAutoFormat
bool m_bCollapsingBorders;
SvxShadowItem m_aShadow;
+ bool m_bHidden;
+ bool m_bUserDefined;
public:
SwTableAutoFormat( const OUString& rName );
SwTableAutoFormat( const SwTableAutoFormat& rNew );
@@ -296,6 +298,11 @@ public:
bool IsBackground() const { return bInclBackground; }
bool IsValueFormat() const { return bInclValueFormat; }
+ /// Check if style is hidden.
+ bool IsHidden() const { return m_bHidden; }
+ /// Check if style is defined by user.
+ bool IsUserDefined() const { return m_bUserDefined; }
+
void SetFont( const bool bNew ) { bInclFont = bNew; }
void SetJustify( const bool bNew ) { bInclJustify = bNew; }
void SetFrame( const bool bNew ) { bInclFrame = bNew; }
@@ -303,6 +310,11 @@ public:
void SetValueFormat( const bool bNew ) { bInclValueFormat = bNew; }
void SetWidthHeight( const bool bNew ) { bInclWidthHeight = bNew; }
+ /// Set if style is hidden.
+ void SetHidden(bool bHidden) { m_bHidden = bHidden; }
+ /// Set if style is user defined.
+ void SetUserDefined(bool bUserDefined) { m_bUserDefined = bUserDefined; }
+
/// These methods returns what style (row or column) is applied first on given Cell
bool FirstRowEndColumnIsRow();
bool FirstRowStartColumnIsRow();
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index 87de4941bc8e..1d3d1ae0f15f 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -361,6 +361,11 @@ interface BaseTextSelection
StateMethod = StateStyle ;
]
+ SID_STYLE_FAMILY6 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
SID_CLASSIFICATION_APPLY
[
ExecMethod = Execute ;
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
index 263dc15b7b64..3bb9b7fb2fce 100644
--- a/sw/sdi/_docsh.sdi
+++ b/sw/sdi/_docsh.sdi
@@ -109,6 +109,12 @@ interface BaseTextDocument
StateMethod = StateStyleSheet ;
]
+ SID_STYLE_FAMILY6
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+
SID_ATTR_YEAR2000
[
ExecMethod = Execute ;
diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi
index fbefb5e5e127..802024692a2a 100644
--- a/sw/sdi/annotsh.sdi
+++ b/sw/sdi/annotsh.sdi
@@ -303,6 +303,11 @@ interface Annotation : _Annotation
StateMethod = StateDisableItems ;
]
+ SID_STYLE_FAMILY6
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
SID_STYLE_WATERCAN // status()
[
StateMethod = StateDisableItems ;
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index c780f811aa6e..88fddf44894d 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -65,6 +65,8 @@
#include <poolfmt.hrc>
#include <GetMetricVal.hxx>
#include <numrule.hxx>
+#include <swtable.hxx>
+#include <tblafmt.hxx>
#include <svx/xdef.hxx>
//UUUU
@@ -133,6 +135,20 @@ bool SwDoc::IsUsed( const SwModify& rModify ) const
return !rModify.GetInfo( aGetHt );
}
+// See if Table style is in use
+bool SwDoc::IsUsed( const SwTableAutoFormat& rTableAutoFormat) const
+{
+ size_t nTableCount = GetTableFrameFormatCount(true);
+ for (size_t i=0; i < nTableCount; ++i)
+ {
+ SwFrameFormat* pFrameFormat = &GetTableFrameFormat(i, true);
+ SwTable* pTable = SwTable::FindTable(pFrameFormat);
+ if (pTable->GetTableStyleName() == rTableAutoFormat.GetName())
+ return true;
+ }
+ return false;
+}
+
// See if the NumRule is used
bool SwDoc::IsUsed( const SwNumRule& rRule )
{
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 0034998e75f3..f31fe77d5f81 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -600,6 +600,8 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
, m_bRowSplit( true )
, m_bCollapsingBorders(true)
, m_aShadow( RES_SHADOW )
+ , m_bHidden( false )
+ , m_bUserDefined( true )
{
bInclFont = true;
bInclJustify = true;
@@ -655,6 +657,8 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew )
m_bRowSplit = rNew.m_bRowSplit;
m_bCollapsingBorders = rNew.m_bCollapsingBorders;
m_aShadow = rNew.m_aShadow;
+ m_bHidden = rNew.m_bHidden;
+ m_bUserDefined = rNew.m_bUserDefined;
return *this;
}
@@ -1018,6 +1022,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
}
}
}
+ m_bUserDefined = false;
return bRet;
}
@@ -1259,6 +1264,7 @@ SwTableAutoFormatTable::SwTableAutoFormatTable()
const_cast<SwBoxAutoFormat&>(pNew->GetBoxFormat( i )).SetBox( aBox );
}
+ pNew->SetUserDefined(false);
m_pImpl->m_AutoFormats.push_back(std::move(pNew));
}
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index f8236a19dfca..8d19c739f2ab 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1175,6 +1175,21 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const
return false;
}
+bool SwFEShell::SetTableStyle(const OUString& rStyleName)
+{
+ // make sure SwDoc has the style
+ SwTableAutoFormat *pTableFormat = GetDoc()->GetTableStyles().FindAutoFormat(rStyleName);
+ if (!pTableFormat)
+ return false;
+
+ SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
+ if (!pTableNode)
+ return false;
+
+ // set the name & update
+ return UpdateTableStyleFormatting(pTableNode, false, &rStyleName);
+}
+
// AutoFormat for the table/table selection
bool SwFEShell::SetTableStyle(const SwTableAutoFormat& rStyle)
{
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 4f8bcdbed691..5ce2a0b872af 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -74,9 +74,9 @@ ImageList RID_DEFAULTIMAGELIST_LC
MaskColor = IMAGE_MASK_COLOR ; \
IdList = \
{ \
- 1; 2; 3; 4; 5; \
+ 1; 2; 3; 4; 5; 6;\
}; \
- IdCount = 5;
+ IdCount = 6;
SfxStyleFamilies DLG_STYLE_DESIGNER
{
@@ -150,6 +150,18 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
};
Text [ en-US ] = "List Styles" ;
};
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Table Styles" ;
+ StyleFamily = SfxStyleFamily::Table ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+ < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
};
ImageList 1 // == BMP_COLOR_NORMAL + 1
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index e66742fea220..4a1e742aad93 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -227,6 +227,15 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
rSet.Put(SfxTemplateItem(nWhich, aName));
}
break;
+ case SID_STYLE_FAMILY6:
+ {
+ const SwTableNode *pTableNd = pShell->IsCursorInTable();
+ if( pTableNd )
+ aName = pTableNd->GetTable().GetTableStyleName();
+
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
case SID_STYLE_WATERCAN:
{
@@ -410,6 +419,9 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
else
if(aFamily == "NumberingStyles")
nFamily = SfxStyleFamily::Pseudo;
+ else
+ if(aFamily == "TableStyles")
+ nFamily = SfxStyleFamily::Table;
}
if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK,
@@ -960,6 +972,11 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFa
pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
break;
}
+ case SfxStyleFamily::Table:
+ {
+ pSh->SetTableStyle(pStyle->GetName());
+ break;
+ }
default:
OSL_FAIL("Unknown family");
}
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 91c5c3b21786..f99b5eabdf90 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -649,6 +649,17 @@ void SwDocStyleSheet::SetHidden( bool bValue )
}
break;
+ case SfxStyleFamily::Table:
+ {
+ SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
+ if ( pTableAutoFormat )
+ {
+ pTableAutoFormat->SetHidden( bValue );
+ bChg = true;
+ }
+ }
+ break;
+
default:
break;
}
@@ -698,6 +709,12 @@ bool SwDocStyleSheet::IsHidden( ) const
bRet = pRule && pRule->IsHidden( );
}
break;
+ case SfxStyleFamily::Table:
+ {
+ SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
+ bRet = pTableAutoFormat && pTableAutoFormat->IsHidden( );
+ }
+ break;
default:
break;
}
@@ -1263,9 +1280,9 @@ std::unique_ptr<SfxItemSet> lcl_SwFormatToFlatItemSet(SwFormat *const pFormat)
std::unique_ptr<SfxItemSet> SwDocStyleSheet::GetItemSetForPreview()
{
- if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily)
+ if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily || SfxStyleFamily::Table == nFamily)
{
- SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or number style");
+ SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or number or table style");
return std::unique_ptr<SfxItemSet>();
}
if (!bPhysical)
@@ -1988,6 +2005,7 @@ bool SwDocStyleSheet::FillStyleSheet(
case SfxStyleFamily::Table:
pTableFormat = lcl_FindTableStyle(rDoc, aName, this);
+ SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SFXSTYLEBIT_USERDEF : 0);
bRet = bPhysical = (nullptr != pTableFormat);
break;
@@ -2164,6 +2182,7 @@ void SwDocStyleSheet::PresetNameAndFamily(const OUString& rName)
case cFRAME: nFamily = SfxStyleFamily::Frame; break;
case cPAGE: nFamily = SfxStyleFamily::Page; break;
case cNUMRULE: nFamily = SfxStyleFamily::Pseudo; break;
+ case cTABSTYLE: nFamily = SfxStyleFamily::Table; break;
default: nFamily = SfxStyleFamily::Char; break;
}
aName = rName.copy(1);
@@ -2212,6 +2231,9 @@ bool SwDocStyleSheet::IsUsed() const
case SfxStyleFamily::Pseudo:
return pNumRule && SwDoc::IsUsed( *pNumRule );
+ case SfxStyleFamily::Table:
+ return pTableFormat && rDoc.IsUsed( *pTableFormat );
+
default:
OSL_ENSURE(false, "unknown style family");
return false;
@@ -2980,7 +3002,23 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
for(size_t i = 0; i < rTableStyles.size(); ++i)
{
- aLst.Append( cTABSTYLE, rTableStyles[i].GetName() );
+ const SwTableAutoFormat& rTableStyle = rTableStyles[i];
+
+ bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
+ if(!bUsed)
+ {
+ if(nSrchMask == SFXSTYLEBIT_HIDDEN && !rTableStyle.IsHidden())
+ continue;
+
+ if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
+ ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !rTableStyle.IsUserDefined()
+ // searched for used and found none
+ : bIsSearchUsed ) )
+ continue;
+ }
+
+ aLst.Append( cTABSTYLE, rTableStyle.GetName() );
}
}