Compare commits

..

11 Commits

14 changed files with 93 additions and 56 deletions

View File

@ -72,6 +72,10 @@ extern NSString *const SRHTTPResponseErrorKey;
// Optional array of cookies (NSHTTPCookie objects) to apply to the connections
@property (nonatomic, readwrite) NSArray * requestCookies;
// Optional proxy configuration dictionary (kCFStreamPropertyHTTPProxy format).
// Set before calling -open. Example: Proxyman at 127.0.0.1:9090.
@property (nonatomic, strong) NSDictionary *proxyDictionary;
// This returns the negotiated protocol.
// It will be nil until after the handshake completes.
@property (nonatomic, readonly, copy) NSString *protocol;

View File

@ -619,7 +619,16 @@ static __strong NSData *CRLFCRLF;
_inputStream.delegate = self;
_outputStream.delegate = self;
if (self.proxyDictionary) {
CFReadStreamSetProperty((__bridge CFReadStreamRef)_inputStream,
kCFStreamPropertyHTTPProxy,
(__bridge CFDictionaryRef)self.proxyDictionary);
CFWriteStreamSetProperty((__bridge CFWriteStreamRef)_outputStream,
kCFStreamPropertyHTTPProxy,
(__bridge CFDictionaryRef)self.proxyDictionary);
}
[self setupNetworkServiceType:_urlRequest.networkServiceType];
}

View File

@ -38,6 +38,8 @@
#include <memory>
#include "../../../../../DesktopEditor/graphics/BaseThread.h"
#define _LOGGER_SOCKETS
namespace NSNetwork
{
namespace NSWebSocket
@ -124,6 +126,10 @@ namespace NSNetwork
}
//webSocket.connect(url, queryDst, sio::string_message::create(sAuth));
#ifdef _LOGGER_SOCKETS
m_socket->set_proxy_basic_auth("http://127.0.0.1:9090", "", "");
#endif
m_connecting_in_process = true;
m_socket->connect(m_base->url, queryDst, objAuth);

View File

@ -42,6 +42,8 @@
#include <memory>
#include "../../../../../DesktopEditor/graphics/BaseThread.h"
#define _LOGGER_SOCKETS
namespace NSNetwork
{
namespace NSWebSocket
@ -113,6 +115,10 @@ namespace NSNetwork
}
//webSocket.connect(url, queryDst, sio_no_tls::string_message::create(sAuth));
#ifdef _LOGGER_SOCKETS
m_socket->set_proxy_basic_auth("http://127.0.0.1:9090", "", "");
#endif
m_connecting_in_process = true;
m_socket->connect(m_base->url, queryDst, objAuth);

View File

@ -48,7 +48,7 @@
}
- (void)open
{
{
if (m_url && m_url.length)
{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:m_url]];
@ -58,6 +58,19 @@
protocols:nil
allowsUntrustedSSLCertificates:YES];
self.socket.delegate = self;
#ifdef _LOGGER_SOCKETS
self.socket.proxyDictionary = @{
(NSString *)kCFNetworkProxiesHTTPEnable: @YES,
(NSString *)kCFNetworkProxiesHTTPProxy: @"127.0.0.1",
(NSString *)kCFNetworkProxiesHTTPPort: @9090,
(NSString *)kCFNetworkProxiesHTTPSEnable: @YES,
(NSString *)kCFNetworkProxiesHTTPSProxy: @"127.0.0.1",
(NSString *)kCFNetworkProxiesHTTPSPort: @9090
};
NSLog(@"[SocketRocket] Proxyman proxy enabled: 127.0.0.1:9090");
#endif
[self.socket open];
}
}
@ -65,7 +78,7 @@
- (void)send:(NSString*)message
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SEND TO SOCKET -------------------");
NSLog(@"%@", message);
@ -101,7 +114,7 @@
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SOCKET RECEIVE MESSAGE -------------------");
NSLog(@"%@", message);
@ -119,7 +132,7 @@
{
m_listener->onOpen();
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SOCKET OPEN -------------------");
NSLog(@"URL : %@", webSocket.url);
@ -134,7 +147,7 @@
{
m_listener->onError(error.localizedDescription.stdstring);
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"---------------------------------------------------------");
NSLog(@"------------------- SOCKET ERROR : %@ ------------", error);
@ -147,7 +160,7 @@
{
m_listener->onClose(code, reason.stdstring);
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"---------------------------------------------------------");
NSLog(@"------------------- SOCKET CLOSE : %@ -----------", reason);
@ -158,7 +171,7 @@
- (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSString *str = [[NSString alloc] initWithData:pongPayload encoding:NSUTF8StringEncoding];

View File

@ -478,6 +478,15 @@ core_android {
!core_android_no_unistd {
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
}
core_release {
QMAKE_CFLAGS += -g0
QMAKE_CXXFLAGS += -g0
QMAKE_LFLAGS += -Wl,-s
QMAKE_CFLAGS -= -fno-limit-debug-info
QMAKE_CXXFLAGS -= -fno-limit-debug-info
}
}
core_debug {

View File

@ -267,7 +267,7 @@ namespace SimpleTypes
std::wstring CGuid::ToString (bool braces) const
{
std::wstringstream sstream;
sstream << boost::wformat( L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k;
sstream << boost::wformat( L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k;
std::wstring res = (braces ? L"{" : L"") + sstream.str() + (braces ? L"}" : L"");
return res;
}

View File

@ -227,7 +227,7 @@ namespace OOX
}
//------------------------------------------------------------------------------------------------------------------------
CDocument::CDocument(OOX::Document *pMain, OOX::FileType type)
: File(pMain), IFileContainer(pMain), WritingElementWithChilds<>(pMain)
: File(pMain), IFileContainer(pMain), WritingElement(pMain)
{
m_bMacroEnabled = false;
@ -254,7 +254,7 @@ namespace OOX
}
}
CDocument::CDocument(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath, OOX::FileType type)
: File(pMain), IFileContainer(pMain), WritingElementWithChilds<>(pMain)
: File(pMain), IFileContainer(pMain), WritingElement(pMain)
{
m_bMacroEnabled = false;
@ -302,13 +302,13 @@ namespace OOX
docx->m_bGlossaryRead = false;
}
}
CDocument::CDocument(XmlUtils::CXmlNode& oNode) : File(NULL), IFileContainer(NULL), WritingElementWithChilds<>(NULL)
CDocument::CDocument(XmlUtils::CXmlNode& oNode) : File(NULL), IFileContainer(NULL), WritingElement(NULL)
{
m_bMacroEnabled = false;
fromXML( oNode );
}
CDocument::CDocument(XmlUtils::CXmlLiteReader& oReader) : File(NULL), IFileContainer(NULL), WritingElementWithChilds<>(NULL)
CDocument::CDocument(XmlUtils::CXmlLiteReader& oReader) : File(NULL), IFileContainer(NULL), WritingElement(NULL)
{
m_bMacroEnabled = false;
@ -403,7 +403,8 @@ namespace OOX
{
if (document->m_arrSections.empty())
{
document->m_arrSections.emplace_back();
OOX::CDocument::_section section;
document->m_arrSections.push_back(section);
}
document->m_arrSections.back().sect = m_oSectPr.GetPointer();
document->m_arrSections.back().end_elm = document->m_arrItems.size(); //активный рутовый еще не добавлен
@ -491,7 +492,11 @@ namespace OOX
void CDocument::ClearItems()
{
WritingElementWithChilds<>::ClearItems();
for ( size_t i = 0; i < m_arrItems.size(); ++i)
{
if ( m_arrItems[i] )delete m_arrItems[i];
}
m_arrItems.clear();
//----------
m_arrSections.clear();
}

View File

@ -127,7 +127,7 @@ namespace OOX
//--------------------------------------------------------------------------------
// CDocument 17.2.3 (Part 1)
//--------------------------------------------------------------------------------
class CDocument : public OOX::File, public IFileContainer, public WritingElementWithChilds<>
class CDocument : public OOX::File, public IFileContainer, public WritingElement
{
public:
CDocument(OOX::Document *pMain = NULL, OOX::FileType type = OOX::FileTypes::Document);
@ -171,6 +171,8 @@ namespace OOX
nullable<OOX::Logic::CSectionProperty> m_oSectPr;
nullable<OOX::Logic::CBackground> m_oBackground;
std::vector<WritingElement*> m_arrItems;
//---------------------------------------------------------------------------------------------
struct _section
{

View File

@ -185,10 +185,10 @@ namespace OOX
{
if (m_oParagraphProperty)
{
pItem = new CParagraphProperty(*m_oParagraphProperty);
pItem->fromXML(oItem);
m_oParagraphProperty = dynamic_cast<CParagraphProperty*>(pItem);
CParagraphProperty prop2(oItem);
CParagraphProperty newProp = CParagraphProperty::Merge(*m_oParagraphProperty, prop2);
pItem = m_oParagraphProperty = new CParagraphProperty(newProp);
}
else
{
@ -331,10 +331,12 @@ namespace OOX
{// c копией .. для быстрого доступа/анализа
if (m_oParagraphProperty)
{
pItem = new CParagraphProperty(*m_oParagraphProperty);
pItem->m_pMainDocument = document;
CParagraphProperty prop2(document);
prop2.fromXML(oReader);
m_oParagraphProperty = dynamic_cast<CParagraphProperty*>(pItem);
pItem = m_oParagraphProperty = new CParagraphProperty(CParagraphProperty::Merge(*m_oParagraphProperty, prop2));
m_arrItems.push_back( pItem );
continue;
}
else
{
@ -381,21 +383,9 @@ namespace OOX
}
else if (L"p" == sName)
{
WritingElementWithChilds* parent = dynamic_cast<WritingElementWithChilds*>(m_oParent);
if (parent)
{
WritingElement* pItemUpper = new CParagraph(document, parent);
if (pItemUpper)
{
pItemUpper->fromXML(oReader);
parent->m_arrItems.push_back(pItemUpper);
}
}
else
{
int nDepthChild = oReader.GetDepth();
fromXML(nDepthChild, oReader);
}
int nDepthChild = oReader.GetDepth();
fromXML(nDepthChild, oReader);
}
if ( pItem )
{

View File

@ -582,7 +582,7 @@ namespace OOX
}
}
}
void CParagraphProperty::fromXML(XmlUtils::CXmlLiteReader& oReader/*, bool bEmbedded*/)
void CParagraphProperty::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -659,13 +659,15 @@ namespace OOX
if (doc->m_arrSections.empty())
{
doc->m_arrSections.emplace_back();
OOX::CDocument::_section section;
doc->m_arrSections.push_back(section);
}
doc->m_arrSections.back().sect = m_oSectPr.GetPointer();
doc->m_arrSections.back().end_elm = doc->m_arrItems.size() + 1; // порядок выше - сначала читаем, потом добавляем
doc->m_arrSections.emplace_back();
doc->m_arrSections.back().start_elm = doc->m_arrItems.size() + 1;
OOX::CDocument::_section section;
section.start_elm = doc->m_arrItems.size() + 1;
doc->m_arrSections.push_back(section);
}
}
}

View File

@ -1225,7 +1225,6 @@ namespace OOX
}break;
case 1:
{
pReader->Skip(4); // size
content = pReader->GetString2();
}break;
default:

View File

@ -443,10 +443,9 @@ void embeddings::write(const std::wstring & RootPath)
items[i].type == typeControlProps ||
items[i].type == typeControl))
{
size_t pos_off = items[i].outputName.rfind(L"/");
size_t pos = items[i].outputName.rfind(L".");
std::wstring extension = (pos != std::wstring::npos && pos > pos_off) ? items[i].outputName.substr(pos + 1) : L"";
int pos = items[i].outputName.rfind(L".");
std::wstring extension = pos >= 0 ? items[i].outputName.substr(pos + 1) : L"";
content_types.add_or_find_default(extension);

View File

@ -155,11 +155,11 @@ namespace utils//////////////////////////////////////////// ОБЩАЯ хрен
{
nDate = boost::lexical_cast<__int64>(oox_date_time);
}
bool bPT = (nDate < 1);
std::wstring sDate, sTime;
if (dTime > 0)
{
sTime = convert_time(dTime, bPT);
sTime = convert_time(dTime, false);
}
if (nDate > 0)
{
@ -177,14 +177,7 @@ namespace utils//////////////////////////////////////////// ОБЩАЯ хрен
}
else
{
if (bPT)
{
odf_date_time = L"PT" + sTime;
}
else
{
odf_date_time = sDate + (sTime.empty() ? L"" : L"T" + sTime);
}
odf_date_time = sDate + (sTime.empty() ? L"" : L"T" + sTime);
}
return res;
}