Kaydet (Commit) f7c841f5 authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

lok: calc: set outline state

use a specific message from the client for set the visibility state of
a group instead of hijacking the update row/column header message

Change-Id: I9634c24bbffaddc916c8ad716ac6d5d31e735a55
Reviewed-on: https://gerrit.libreoffice.org/45445Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
Tested-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst 6f2f339d
...@@ -599,6 +599,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, ...@@ -599,6 +599,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis,
int nTileTwipWidth, int nTileTwipWidth,
int nTileTwipHeight); int nTileTwipHeight);
static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
static int doc_createView(LibreOfficeKitDocument* pThis); static int doc_createView(LibreOfficeKitDocument* pThis);
static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId);
static void doc_setView(LibreOfficeKitDocument* pThis, int nId); static void doc_setView(LibreOfficeKitDocument* pThis, int nId);
...@@ -656,6 +657,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone ...@@ -656,6 +657,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getCommandValues = doc_getCommandValues; m_pDocumentClass->getCommandValues = doc_getCommandValues;
m_pDocumentClass->setClientZoom = doc_setClientZoom; m_pDocumentClass->setClientZoom = doc_setClientZoom;
m_pDocumentClass->setClientVisibleArea = doc_setClientVisibleArea; m_pDocumentClass->setClientVisibleArea = doc_setClientVisibleArea;
m_pDocumentClass->setOutlineState = doc_setOutlineState;
m_pDocumentClass->createView = doc_createView; m_pDocumentClass->createView = doc_createView;
m_pDocumentClass->destroyView = doc_destroyView; m_pDocumentClass->destroyView = doc_destroyView;
...@@ -2986,10 +2988,6 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo ...@@ -2986,10 +2988,6 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
int nY = 0; int nY = 0;
int nWidth = 0; int nWidth = 0;
int nHeight = 0; int nHeight = 0;
bool bColumn = false;
int nLevel = -1;
int nGroupIndex = -2;
bool bHidden = false;
OString aArguments = aCommand.copy(aViewRowColumnHeaders.getLength() + 1); OString aArguments = aCommand.copy(aViewRowColumnHeaders.getLength() + 1);
sal_Int32 nParamIndex = 0; sal_Int32 nParamIndex = 0;
do do
...@@ -3015,23 +3013,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo ...@@ -3015,23 +3013,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
nWidth = aValue.toInt32(); nWidth = aValue.toInt32();
else if (aKey == "height") else if (aKey == "height")
nHeight = aValue.toInt32(); nHeight = aValue.toInt32();
else if (aKey == "columnOutline")
bColumn = aValue.toBoolean();
else if (aKey == "groupLevel")
nLevel = aValue.toInt32();
else if (aKey == "groupIndex")
nGroupIndex = aValue.toInt32();
else if (aKey == "groupHidden")
bHidden = aValue.toBoolean();
} }
while (nParamIndex >= 0); while (nParamIndex >= 0);
aRectangle = tools::Rectangle(nX, nY, nX + nWidth, nY + nHeight); aRectangle = tools::Rectangle(nX, nY, nX + nWidth, nY + nHeight);
if (nGroupIndex != -2)
{
pDoc->setOutlineState(bColumn, nLevel, nGroupIndex, bHidden);
}
} }
OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle); OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle);
...@@ -3133,6 +3118,20 @@ static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int ...@@ -3133,6 +3118,20 @@ static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int
pDoc->setClientVisibleArea(aRectangle); pDoc->setClientVisibleArea(aRectangle);
} }
static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden)
{
SolarMutexGuard aGuard;
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
return;
}
pDoc->setOutlineState(bColumn, nLevel, nIndex, bHidden);
}
static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
......
...@@ -224,9 +224,13 @@ struct _LibreOfficeKitDocumentClass ...@@ -224,9 +224,13 @@ struct _LibreOfficeKitDocumentClass
int nTilePixelHeight, int nTilePixelHeight,
int nTileTwipWidth, int nTileTwipWidth,
int nTileTwipHeight); int nTileTwipHeight);
/// @see lok::Document::setVisibleArea). /// @see lok::Document::setVisibleArea).
void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
/// @see lok::Document::setOutlineState).
void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
/// @see lok::Document::createView(). /// @see lok::Document::createView().
int (*createView) (LibreOfficeKitDocument* pThis); int (*createView) (LibreOfficeKitDocument* pThis);
/// @see lok::Document::destroyView(). /// @see lok::Document::destroyView().
......
...@@ -447,6 +447,19 @@ public: ...@@ -447,6 +447,19 @@ public:
mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight); mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight);
} }
/**
* Show/Hide a single row/column header outline for Calc documents.
*
* @param bColumn - if we are dealing with a column or row group
* @param nLevel - the level to which the group belongs
* @param nIndex - the group entry index
* @param bHidden - the new group state (collapsed/expanded)
*/
void setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
{
mpDoc->pClass->setOutlineState(mpDoc, bColumn, nLevel, nIndex, bHidden);
}
/** /**
* Create a new view for an existing document. * Create a new view for an existing document.
* By default a loaded document has 1 view. * By default a loaded document has 1 view.
......
...@@ -143,19 +143,6 @@ public: ...@@ -143,19 +143,6 @@ public:
return OUString(); return OUString();
} }
/**
* Show/Hide a single row/column header outline for Calc documents.
*
* @param bColumn - if we are dealing with a column or row group
* @param nLevel - the level to which the group belongs
* @param nIndex - the group entry index
* @param bHidden - the new group state (collapsed/expanded)
*/
virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
{
return;
}
/** /**
* Get position and content of row/column headers of Calc documents. * Get position and content of row/column headers of Calc documents.
* *
...@@ -206,6 +193,19 @@ public: ...@@ -206,6 +193,19 @@ public:
{ {
} }
/**
* Show/Hide a single row/column header outline for Calc documents.
*
* @param bColumn - if we are dealing with a column or row group
* @param nLevel - the level to which the group belongs
* @param nIndex - the group entry index
* @param bHidden - the new group state (collapsed/expanded)
*/
virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
{
return;
}
/// Implementation for /// Implementation for
/// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
/// is no matching UNO API. /// is no matching UNO API.
......
...@@ -958,20 +958,6 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int ...@@ -958,20 +958,6 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int
mnTileTwipHeight = nTileTwipHeight_; mnTileTwipHeight = nTileTwipHeight_;
} }
void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
{
ScViewData* pViewData = ScDocShell::GetViewData();
if (!pViewData)
return;
ScDBFunc* pFunc = pViewData->GetView();
if (pFunc)
pFunc->SetOutlineState(bColumn, nLevel, nIndex, bHidden);
}
OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle) OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
{ {
ScViewData* pViewData = ScDocShell::GetViewData(); ScViewData* pViewData = ScDocShell::GetViewData();
...@@ -1045,6 +1031,19 @@ void ScModelObj::setClientVisibleArea(const tools::Rectangle& rRectangle) ...@@ -1045,6 +1031,19 @@ void ScModelObj::setClientVisibleArea(const tools::Rectangle& rRectangle)
pViewData->ForcePageUpDownOffset(rRectangle.GetHeight()); pViewData->ForcePageUpDownOffset(rRectangle.GetHeight());
} }
void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
{
ScViewData* pViewData = ScDocShell::GetViewData();
if (!pViewData)
return;
ScDBFunc* pFunc = pViewData->GetView();
if (pFunc)
pFunc->SetOutlineState(bColumn, nLevel, nIndex, bHidden);
}
OUString ScModelObj::getPostIts() OUString ScModelObj::getPostIts()
{ {
if (!pDocShell) if (!pDocShell)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment